Spring security AntMatcher is not working

前端 未结 2 1303
情深已故
情深已故 2021-01-27 05:47

This is the way I have configured spring security, in controller I\'m getting ROLE_ANONYMOUS as authority. Looks like security is not intercepting the request and checking for J

2条回答
  •  -上瘾入骨i
    2021-01-27 06:27

    What version of spring-boot and spring-security are you using?

    The @EnableResourceServer annotation adds a filter of type OAuth2AuthenticationProcessingFilter automatically to the Spring Security filter chain.

    So to your "extends ResourceServerConfigurerAdapter" be applyed before the OAuth2AuthenticationProcessingFilter, you'll need to annotate it with @Order (-1)

    @Configuration
    @EnableResourceServer
    @Order(-1)
    public class ResourceServerConfig extends ResourceServerConfigurerAdapter{
    [...]
    

提交回复
热议问题