UsernamePasswordToken token = new UsernamePasswordToken("koorye", "12345678");
运行:
1 2 3 4 5 6 7 8 9 10 11 12 13
org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - koorye, rememberMe=false] did not match the expected credentials. at org.apache.shiro.realm.AuthenticatingRealm.assertCredentialsMatch(AuthenticatingRealm.java:603) at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:581) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:273) at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106) at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:275) at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:260) at org.koorye.HelloShiro.main(HelloShiro.java:21) 密码错误
Process finished with exit code 0
如果用户名不存在:
1
UsernamePasswordToken token = new UsernamePasswordToken("kkkoorye", "12345678");
运行:
1 2 3 4 5 6 7 8 9 10 11
org.apache.shiro.authc.UnknownAccountException: Realm [org.apache.shiro.realm.text.IniRealm@3b95a09c] was unable to find account data for the submitted AuthenticationToken [org.apache.shiro.authc.UsernamePasswordToken - kkkoorye, rememberMe=false]. at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:184) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:273) at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106) at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:275) at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:260) at org.koorye.HelloShiro.main(HelloShiro.java:21) 用户名不存在