Springboot集成shiro记住我功能出错.

2019-01-17 14:36:57,384 - Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - null, rememberMe=false (0:0:0:0:0:0:0:1)].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
java.lang.NullPointerException: null
    at com.tansuo365.test1.realm.DatabaseRealm.doGetAuthenticationInfo(DatabaseRealm.java:57)
    at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
    at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
    at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
    at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
    at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)

只要是记住我字段进来就出错.否则没事.
这样是没错的:

UsernamePasswordToken token = new UsernamePasswordToken(name,password);

这样就报错了:

UsernamePasswordToken token = new UsernamePasswordToken(name, password, subject.isRemembered());

或者这样也报错:

 UsernamePasswordToken token = new UsernamePasswordToken(name, password, rememberMe);
阅读 4.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏