|
@@ -80,15 +80,13 @@ public class ShiroRealm extends AuthorizingRealm {
|
|
|
*/
|
|
|
@Override
|
|
|
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
|
|
|
- if (!Check.isNull(auth)) {
|
|
|
- String token = (String) auth.getCredentials();
|
|
|
- if (token != null) {
|
|
|
- QYWxUserInfo loginUser = this.checkUserTokenIsEffect(token);
|
|
|
- return new SimpleAuthenticationInfo(loginUser, token, getName());
|
|
|
- }
|
|
|
+ String token = (String) auth.getCredentials();
|
|
|
+ if(null == token){
|
|
|
+ throw new AuthenticationException("token为空!");
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ QYWxUserInfo loginUser = this.checkUserTokenIsEffect(token);
|
|
|
+ return new SimpleAuthenticationInfo(loginUser, token, getName());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -104,14 +102,14 @@ public class ShiroRealm extends AuthorizingRealm {
|
|
|
}
|
|
|
|
|
|
// 解密获得username,用于和数据库进行对比
|
|
|
- String openId = JwtUtil.getUsername(token); //username即为open_id
|
|
|
+ //username即为open_id
|
|
|
+ String openId = JwtUtil.getUsername(token);
|
|
|
if (openId == null) {
|
|
|
log.error("token非法无效!");
|
|
|
throw new AuthenticationException("token非法无效!");
|
|
|
}
|
|
|
// 查询用户信息
|
|
|
QYWxUserInfo loginUser = new QYWxUserInfo();
|
|
|
- //CorpUserInfo userInfo = corpUserInfoMapper.getUserInfoByOpenId(openId);
|
|
|
QYWxUserInfo userInfo = wxUserInfoMapper.getUserInfoByOpenId(openId);
|
|
|
if (userInfo == null) {
|
|
|
throw new AuthenticationException("用户不存在!");
|