/** * 认证缓存key,登录时调用,默认使用token值,使用缓存时才调用此方法 {@link * org.apache.shiro.realm.AuthenticatingRealm#getAuthenticationCacheKey(org.apache.shiro.authc.AuthenticationToken)} * * @param token token * @return key */ protected Object getAuthenticationCacheKey(AuthenticationToken token) { UsernamePasswordToken simpleToken = (UsernamePasswordToken) token; Object id = realmService.getUniqueIdentity(simpleToken.getUsername().toLowerCase()); if (id != null) { return "DRC_" + id; } return null; }