No AuthenticationProvider found for UsernamePasswordAuthenticationToken

后端 未结 2 546
你的背包
你的背包 2020-12-14 09:07

my web.xml config is


        springSecurityFilterChain
        org.springframework.         


        
相关标签:
2条回答
  • 2020-12-14 09:45

    As you already wrote in your comment the problem is that you always return false in the supports() method of your autentication provider. But instead of always returning true you should check the authentication you get like this:

    public class MyAuthenticationProvider implements AuthenticationProvider, Serializable {
    
        @Override
        public boolean supports(Class<? extends Object> authentication) {
            return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
        }
    
        // ...
    }
    
    0 讨论(0)
  • 2020-12-14 09:53

    I had the same issue. In my case the solution was to set AbstractAuthenticationToken.setAuthenticated to true after the authentication passed.

    0 讨论(0)
提交回复
热议问题