Commit 7fa826dd by tyfanchz

密码校验策略修改

1 parent db1ed3eb
...@@ -2,6 +2,7 @@ package com.glsx.shop.security; ...@@ -2,6 +2,7 @@ package com.glsx.shop.security;
import java.util.Set; import java.util.Set;
import com.glsx.shop.bean.core.AuthorizationUser; import com.glsx.shop.bean.core.AuthorizationUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.AuthenticationToken;
...@@ -66,7 +67,9 @@ public class ApiRealm extends AuthorizingRealm { ...@@ -66,7 +67,9 @@ public class ApiRealm extends AuthorizingRealm {
} }
try { try {
if (!JwtUtil.verify(token, userBean.getPassword())) { String password = userBean.getPassword();
// 修改:当前登录用户密码不为空的情况下才进行密码校验
if (StringUtils.isNotBlank(password) && !JwtUtil.verify(token, password)) {
throw new AuthenticationException("Username or password error"); throw new AuthenticationException("Username or password error");
} }
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!