Авторизованный маршрут - PullRequest
0 голосов
/ 13 июня 2019

У меня проблемы с Spring Security.Я объявил данный маршрут в фильтре цепочки как авторизованный

.antMatchers("/autorized/route/**").permitAll()

, и у меня есть другой маршрут, который не авторизован и требует токен доступа, но когда я пытаюсь получить доступ к авторизованному маршруту, я получаю этоошибка:

org.springframework.security.authentication.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:379)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:223)\
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:124) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

У меня такая же проблема даже с:

@Override
public void configure(WebSecurity web) throws Exception {
    web
        .ignoring()
            .antMatchers("/autorized/route/**")
            .antMatchers(HttpMethod.OPTIONS, "/**");
}

Кстати, метод роут: POST

Isесть ли экспликация?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...