Я использую весеннюю загрузку 2.1.4.RELEASE и пытаюсь выяснить 401 несанкционированную ошибку.
Ниже приведен мой класс webconfig
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/somepath/")
}
@Override
protected void configure(HttpSecurity http) throws Exception {
if(securityEnabled) {
http
.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.anyRequest().authenticated()
.antMatchers("/somepath/").permitAll()
.and()
.httpBasic()
.and()
.anonymous().disable()
.exceptionHandling().authenticationEntryPoint(unauthorizedEntryPoint());
}
В моем основном классе я исключил -
@EnableAutoConfiguration(exclude = {ErrorMvcAutoConfiguration.class,org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class})
Теперь, когда я пытаюсь проверить свой API, используя http://localhost:8080/somepath
, я получаю 401 несанкционированный.Но когда я пробую ту же самую конечную точку с токеном, это работает, что означает, что аутентификация не была успешно отключена.Буду признателен за любую помощь здесь.