本文整理汇总了Java中org.apache.shiro.util.ThreadContext.unbindSubject方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadContext.unbindSubject方法的具体用法?Java ThreadContext.unbindSubject怎么用?Java ThreadContext.unbindSubject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.util.ThreadContext
的用法示例。
在下文中一共展示了ThreadContext.unbindSubject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newCheckStatusRunnable
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
private Runnable newCheckStatusRunnable(Long requestId, Subject subject) {
return new Runnable() {
@Override
public void run() {
try {
ThreadContext.bind(subject);
check(load(requestId));
} catch (Exception e) {
logger.error("Error checking pull request status", e);
} finally {
ThreadContext.unbindSubject();
}
}
};
}
示例2: tearDownShiro
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
/**
* Method description
*
*/
private void tearDownShiro()
{
try
{
SecurityManager securityManager = SecurityUtils.getSecurityManager();
LifecycleUtils.destroy(securityManager);
ThreadContext.unbindSecurityManager();
ThreadContext.unbindSubject();
ThreadContext.remove();
}
catch (UnavailableSecurityManagerException e)
{
// we don't care about this when cleaning up the test environment
// (for example, maybe the subclass is a unit test and it didn't
// need a SecurityManager instance because it was using only mock Subject instances)
}
SecurityUtils.setSecurityManager(null);
}
示例3: run
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
private void run(Runnable runnable) {
UnitOfWork unitOfWork = AppLoader.getInstance(UnitOfWork.class);
unitOfWork.begin();
try {
Subject subject = (Subject) request.getHttpServletRequest().getAttribute(WebSocketFilter.SHIRO_SUBJECT);
ThreadContext.bind(subject);
runnable.run();
} finally {
ThreadContext.unbindSubject();
unitOfWork.end();
}
}
示例4: postStart
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@Sessional
@Override
public void postStart() {
listenerRegistry.post(new SystemStarted());
ThreadContext.unbindSubject();
logger.info("Server is ready at " + configManager.getSystemSetting().getServerUrl() + ".");
initStage = null;
}
示例5: stop
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@Override
public void stop() {
unitOfWork.begin();
try {
listenerRegistry.post(new SystemStopped());
ThreadContext.unbindSubject();
} finally {
unitOfWork.end();
}
persistManager.stop();
taskScheduler.stop();
jettyRunner.stop();
}
示例6: filter
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@Override
public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
Subject subject = ThreadContext.getSubject();
if (subject != null) {
if (subject.isAuthenticated()) {
subject.logout();
}
ThreadContext.unbindSubject();
}
return response;
}
示例7: passivateService
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@Override
public void passivateService()
throws Exception
{
ThreadContext.unbindSubject();
ThreadContext.unbindSecurityManager();
}
示例8: tearDown
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
ThreadContext.unbindSubject();
}
示例9: tearDown
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
ThreadContext.unbindSubject();//退出时请解除绑定Subject到线程 否则对下次测试造成影响
}
示例10: interactionEnds
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
public void interactionEnds()
{
ThreadContext.unbindSubject();
ThreadContext.unbindSecurityManager();
}
示例11: cleanup
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void cleanup() {
ThreadContext.unbindSubject();
}
示例12: cleanup
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void cleanup() {
ThreadContext.unbindSubject();
underTest.stop();
}
示例13: reset
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
private void reset() {
MDC.remove(KEY);
ThreadContext.unbindSubject();
ThreadContext.unbindSecurityManager();
}
示例14: tearDown
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@AfterMethod
public void tearDown() {
ThreadContext.unbindSubject();
ThreadContext.unbindSecurityManager();
}
示例15: tearDown
import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@AfterMethod
public void tearDown() {
// This is necessary as once the subject has been set, the security manager is
// ignored. But we want to be able to change the security manager for tests.
ThreadContext.unbindSubject();
}