/*** @title 切换身份,登录后,动态更改subject的用户属性* @param principal* @desc principal为用户的认证信息*/
public static void reloadAuthorizing(User principal) throws Exception{Subject subject = SecurityUtils.getSubject();String realmName = subject.getPrincipals().getRealmNames().iterator().next();SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, realmName);subject.runAs(principals);// 刷新权限//subject.releaseRunAs();
}