增加获取用户日志

This commit is contained in:
wulin 2020-11-20 16:54:24 +08:00
parent 921fc6d7fb
commit a342994b3f

View File

@ -14,6 +14,7 @@ import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.SysUserEntityDto;
import com.lz.modules.sys.entity.SysUserTokenEntity;
import com.lz.modules.sys.service.ShiroService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
@ -30,6 +31,7 @@ import java.util.Set;
* @author Mark sunlightcs@gmail.com
*/
@Component
@Slf4j
public class OAuth2Realm extends AuthorizingRealm {
@Autowired
private ShiroService shiroService;
@ -74,8 +76,10 @@ public class OAuth2Realm extends AuthorizingRealm {
SysUserEntity user = null;
StaffEntity staffEntity = staffService.selectStaffById(tokenEntity.getUserId());
if(tokenEntity.getType() == 0){ //如果是系统用户
log.info("token判定为系统用户");
user = shiroService.queryUser(tokenEntity.getUserId());
if(staffEntity != null){
log.info("查询到系统用户信息");
user.setAvatar(staffEntity.getAvatar());
}