Попытка создать приложение с аутентификацией пользователя с использованием JWT (JSON Web Tokens).Однако когда я начал настраивать WebSecurityConfig.java, я столкнулся со следующей проблемой:
@Override
protected void configure(HttpSecurity http) throws Exception {
String[] permited = new String[security.getIgnored().size()];
security.getIgnored().toArray(permited);
http
.csrf().disable()
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint).and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/user").permitAll()
.antMatchers("/").permitAll()
.antMatchers("/favicon.ico").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginProcessingUrl("/api/authentication")
.successHandler(ajaxAuthenticationSuccessHandler)
.failureHandler(ajaxAuthenticationFailureHandler)
.usernameParameter("username")
.passwordParameter("password")
.and()
.logout()
.logoutUrl("/api/logout")
.logoutSuccessHandler(ajaxLogoutSuccessHandler)
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID");
http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
http.headers().cacheControl();
}
И это показывает, что он «не может восстановить метод getIgnored ()».Это всего лишь первые несколько шагов в начале этого метода.
Я понял, что весной есть 2 класса с одинаковыми именами:
1) https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/security/SecurityProperties.html
2) https://docs.spring.io/spring-boot/docs/2.0.0.M3/api/org/springframework/boot/autoconfigure/security/SecurityProperties.html
Так что мне нужнометод getIgnored () из второго класса.Пожалуйста, помогите мне в этом процессе.Я понимаю, что это может быть глупым вопросом, но я ценю любую помощь.
Кстати, именно так я определяю «безопасность» с помощью аннотации @Autowired:
@Autowired
SecurityProperties security;