springsercuity中 继承的AbstractAuthenticationProcessingFilter写的过滤器,attemptAuthentication的认证问题

写了一个public class JwtLoginFilter extends AbstractAuthenticationProcessingFilter
继承的AbstractAuthenticationProcessingFilter写的过滤器

//   attemptAuthentication():这个方法内部是用来获取 表单的 用户和密码的 ,并判断用户名和密码是使用默认的还是我们自定义的
//
//    successfulAuthentication():认证成功后 调用的方法
//
//    unsuccessfulAuthentication():认证失败后 调用的方法
在attemptAuthentication()的认证中出现认证失败的问题
如图,密码等是正确的,每次都会在抛出异常,希望得到有效解答,非常感谢!

img

img

img

已经解决:
原因:
AuthenticationManager()为null
需要在 JwtLoginFilter下写入
protected JwtLoginFilter(String defaultFilterProcessesUrl, AuthenticationManager authenticationManager) {
super(new AntPathRequestMatcher(defaultFilterProcessesUrl));
setAuthenticationManager(authenticationManager);//需要setAuthenticationManager
}
并且修改为
Authentication authentication=
getAuthenticationManager().authenticate(usernamePasswordAuthenticationToken);