Commit 3334283f by 唐功亮

【修改】 OAuth2Realm.java

parent 034976e1
......@@ -287,15 +287,12 @@
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j</artifactId>
<version>2.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-light</artifactId>
<version>2.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
......
......@@ -8,6 +8,8 @@
package io.office.modules.sys.oauth2;
import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.sys.entity.SysUserEntity;
import io.office.modules.sys.entity.SysUserTokenEntity;
import io.office.modules.sys.service.ShiroService;
......@@ -30,7 +32,8 @@ import java.util.Set;
public class OAuth2Realm extends AuthorizingRealm {
@Autowired
private ShiroService shiroService;
@Autowired
private MemberDao memberDao;
@Override
public boolean supports(AuthenticationToken token) {
return token instanceof OAuth2Token;
......@@ -67,19 +70,22 @@ public class OAuth2Realm extends AuthorizingRealm {
}
//查询用户信息
SysUserEntity user = null;
SimpleAuthenticationInfo info=null;
if(accessToken.startsWith("qianduan_")) {
//todo
MemberEntity memberEntity = memberDao.selectById(tokenEntity.getUserId());
new SimpleAuthenticationInfo(memberEntity, accessToken, getName());
} else {
user = shiroService.queryUser(tokenEntity.getUserId());
//账号锁定
if(user.getStatus() == 0){
throw new LockedAccountException("账号已被锁定,请联系管理员");
}
new SimpleAuthenticationInfo(user, accessToken, getName());
}
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, accessToken, getName());
// SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, accessToken, getName());
return info;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment