Shiro:org.apache.shiro.authc.AuthenticationException
org.apache.shiro.authc.AuthenticationException: Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - starzou, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException)
<bean id="authorizingRealm" class="com.hk3t.core.security.CmsAuthorizingRealm"> <property name="credentialsMatcher"> <bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"> <property name="hashAlgorithmName" value="MD5"/> <!-- true means hex encoded, false means base64 encoded --> <property name="storedCredentialsHexEncoded" value="true"/> <!-- 迭代次数 --> <property name="hashIterations" value="1" /> </bean> </property> </bean>
如果user的密码是明文密码,但是如果这样设置
<property name="hashAlgorithmName" value="MD5"/>就等于说指定密码的加密方式是MD5,但是此时user的密码是明文密码,所以这样就会报错
解决的办法就是将user的密码用MD5加密,就要就不会有问题了
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: Shiro学习笔记(2)——身份验证之Realm
- 下一篇: shiro登录过程分析