No AuthenticationProvider found for UsernamePasswordAuthenticationToken

后端 未结 2 553
你的背包
你的背包 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 authentication) {
            return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
        }
    
        // ...
    }
    

提交回复
热议问题