当前位置: 首页>>代码示例>>Java>>正文


Java ThreadContext.unbindSubject方法代码示例

本文整理汇总了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();
			}
		}

	};		
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:18,代码来源:DefaultPullRequestManager.java

示例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);
}
 
开发者ID:sdorra,项目名称:shiro-unit,代码行数:26,代码来源:ShiroRule.java

示例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();
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:14,代码来源:WebSocketProcessor.java

示例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;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:GitPlex.java

示例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();
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:15,代码来源:GitPlex.java

示例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;
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:12,代码来源:AuthenticationResourceFilter.java

示例7: passivateService

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@Override
public void passivateService()
        throws Exception
{
    ThreadContext.unbindSubject();
    ThreadContext.unbindSecurityManager();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:8,代码来源:IniSecurityManagerService.java

示例8: tearDown

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
    ThreadContext.unbindSubject();
}
 
开发者ID:l81893521,项目名称:shiro-demo,代码行数:5,代码来源:BaseTest.java

示例9: tearDown

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
    ThreadContext.unbindSubject();//退出时请解除绑定Subject到线程 否则对下次测试造成影响
}
 
开发者ID:l81893521,项目名称:shiro-demo,代码行数:5,代码来源:AuthenticatorTest.java

示例10: interactionEnds

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
public void interactionEnds()
{
    ThreadContext.unbindSubject();
    ThreadContext.unbindSecurityManager();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:6,代码来源:StandaloneShiroTest.java

示例11: cleanup

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void cleanup() {
  ThreadContext.unbindSubject();
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:5,代码来源:AssetDownloadCountStoreImplTest.java

示例12: cleanup

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@After
public void cleanup() {
  ThreadContext.unbindSubject();
  underTest.stop();
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:6,代码来源:AssetDownloadHistoricDataCleanerTest.java

示例13: reset

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
private void reset() {
  MDC.remove(KEY);
  ThreadContext.unbindSubject();
  ThreadContext.unbindSecurityManager();
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:6,代码来源:UserIdMdcHelperTest.java

示例14: tearDown

import org.apache.shiro.util.ThreadContext; //导入方法依赖的package包/类
@AfterMethod
public void tearDown() {
  ThreadContext.unbindSubject();
  ThreadContext.unbindSecurityManager();
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:6,代码来源:ProviderBasedPermissionTest.java

示例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();
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:7,代码来源:DefaultLiveDataManagerTest.java


注:本文中的org.apache.shiro.util.ThreadContext.unbindSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。