需要 @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缓存做