我有很多 (20) 个 jar 文件的文件夹。有没有办法在终端的一个命令中提取所有这些罐子,而不是一个一个地做?我正在使用MAC。
我的自定义过滤器基于UsernamePasswordAuthenticationFilter需求,AuthenticationManager但每次我调用该方法时,attemptAuthentication()编译都会失败:
Authentication auth2 = this.getAuthenticationManager().authenticate(authRequest);
Run Code Online (Sandbox Code Playgroud)
为AuthenticationManager空:
java.lang.NullPointerException: null
at app.shellx.security.CustomUsernamePasswordAuthenticationFilter.attemptAuthentication(CustomUsernamePasswordAuthenticationFilter.java:75) ~[classes/:na]
Run Code Online (Sandbox Code Playgroud)
网络安全配置
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
UserService userService;
@Autowired
private JwtTokenFilter jwtTokenFilter;
@Autowired
private CustomAuthenticationSuccessHandler customAuthenticationSuccessHandler;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.httpBasic().disable()
.addFilterBefore(jwtTokenFilter, UsernamePasswordAuthenticationFilter.class)
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.cors().and()
.csrf().disable()
.authorizeRequests() // .antMatchers("/**")
.antMatchers("/login/**", "/register/**").permitAll()
.antMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
//.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
.addFilterAt(new CustomUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
.formLogin()
.loginPage("http://localhost:4200/login")//.failureUrl("/login-error")
.loginProcessingUrl("/login")
.usernameParameter("email")
.successHandler(customAuthenticationSuccessHandler)
.and()
.logout()
.permitAll();
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用注释来使我的 Spring 应用程序正常工作。但我收到一个错误:未找到元素“context:annotation-config”的前缀“context”。
谁能说出这的根本原因是什么。