NutzCN Logo
问答 每一分钟统计当前用户数量,
发布于 2191天前 作者 qq_ac1ad3b8 1234 次浏览 复制 上一个帖子 下一个帖子
标签:

需要 @Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
Object object = principals.getPrimaryPrincipal();
if (object.getClass().isAssignableFrom(Sys_user.class)) {
Sys_user user = Castors.me().castTo(object, Sys_user.class);
if (!Lang.isEmpty(user) && !user.isDisabled()) {
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
info.addRoles(getUserService().getRoleCodeList(user));
for (Sys_role role : user.getRoles()) {
if (!role.isDisabled())
info.addStringPermissions(getRoleService().getPermissionNameList(role));
}
return info;
} else {
return null;
}
}
return null;
}

public PlatformAuthorizingRealm() {
    this(null, null);
}

public PlatformAuthorizingRealm(CacheManager cacheManager, CredentialsMatcher matcher) {
    super(cacheManager, matcher);
    HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
    hashedCredentialsMatcher.setHashAlgorithmName("SHA-256");
    hashedCredentialsMatcher.setHashIterations(1024);
    hashedCredentialsMatcher.setStoredCredentialsHexEncoded(true);
    setAuthenticationTokenClass(PlatformCaptchaToken.class);
    setCredentialsMatcher(hashedCredentialsMatcher);
}怎么通过readis缓存做
1 回复

没看到 插入代码 的按钮吗?

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部