本文整理了Java中org.apache.shiro.subject.Subject.releaseRunAs()
方法的一些代码示例,展示了Subject.releaseRunAs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.releaseRunAs()
方法的具体详情如下:
包路径:org.apache.shiro.subject.Subject
类名称:Subject
方法名:releaseRunAs
[英]Releases the current 'run as' (assumed) identity and reverts back to the previous 'pre run as' identity that existed before #runAs runAs was called.
This method returns 'run as' (assumed) identity being released or null if this Subject is not operating under an assumed identity.
[中]释放当前的“运行方式”(假定)标识,并恢复到调用#运行方式运行方式之前存在的上一个“预运行方式”标识。
此方法返回正在释放的“运行方式”(假定)标识,如果此主题未在假定标识下运行,则返回null。
代码示例来源:origin: apache/shiro
subject.releaseRunAs();
subject.releaseRunAs();
代码示例来源:origin: theonedev/onedev
@Override
public void process(IFormSubmitter submittingComponent) {
SecurityUtils.getSubject().runAs(getUser().getPrincipals());
try {
super.process(submittingComponent);
} finally {
SecurityUtils.getSubject().releaseRunAs();
}
}
代码示例来源:origin: java-aodeng/hope-plus
/***
* 重新加载用户权限
* @param user
*/
@Override
public void reloadAuthorizingByUserId(SysUser user) {
RealmSecurityManager realmSecurityManager=(RealmSecurityManager) SecurityUtils.getSecurityManager();
HopeShiroRealm hopeShiroReam=(HopeShiroRealm)realmSecurityManager.getRealms().iterator().next();
Subject subject=SecurityUtils.getSubject();
String realmName=subject.getPrincipals().getRealmNames().iterator().next();
SimplePrincipalCollection simplePrincipalCollection=new SimplePrincipalCollection(user,realmName);
subject.runAs(simplePrincipalCollection);
hopeShiroReam.getAuthorizationCache().remove(subject.getPrincipals());
subject.releaseRunAs();
log.info("[以下用户权限更新成功!]-[{}]",user.getUsername());
}
代码示例来源:origin: zhangyd-c/OneBlog
/**
* 重新加载用户权限
*
* @param user
*/
public void reloadAuthorizingByUserId(User user) {
RealmSecurityManager rsm = (RealmSecurityManager) SecurityUtils.getSecurityManager();
ShiroRealm shiroRealm = (ShiroRealm) rsm.getRealms().iterator().next();
Subject subject = SecurityUtils.getSubject();
String realmName = subject.getPrincipals().getRealmNames().iterator().next();
SimplePrincipalCollection principals = new SimplePrincipalCollection(user.getId(), realmName);
subject.runAs(principals);
shiroRealm.getAuthorizationCache().remove(subject.getPrincipals());
subject.releaseRunAs();
log.info("用户[{}]的权限更新成功!!", user.getUsername());
}
代码示例来源:origin: zhangyd-c/springboot-shiro
/**
* 重新加载用户权限
*
* @param user
*/
@Override
public void reloadAuthorizingByUserId(User user) {
RealmSecurityManager rsm = (RealmSecurityManager) SecurityUtils.getSecurityManager();
ShiroRealm shiroRealm = (ShiroRealm) rsm.getRealms().iterator().next();
Subject subject = SecurityUtils.getSubject();
String realmName = subject.getPrincipals().getRealmNames().iterator().next();
SimplePrincipalCollection principals = new SimplePrincipalCollection(user.getId(), realmName);
subject.runAs(principals);
shiroRealm.getAuthorizationCache().remove(subject.getPrincipals());
subject.releaseRunAs();
LOG.info("用户[{}]的权限更新成功!!", user.getUsername());
}
代码示例来源:origin: theonedev/onedev
SecurityUtils.getSubject().releaseRunAs();
内容来源于网络,如有侵权,请联系作者删除!