org.apache.shiro.util.LifecycleUtils Java Examples
The following examples show how to use
org.apache.shiro.util.LifecycleUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApiKeyRealmTest.java From emodb with Apache License 2.0 | 6 votes |
@Before public void setup() { CacheRegistry cacheRegistry = new DefaultCacheRegistry(new SimpleLifeCycleRegistry(), new MetricRegistry()); InvalidatableCacheManager _cacheManager = new GuavaCacheManager(cacheRegistry); InMemoryAuthIdentityManager<ApiKey> authIdentityDAO = new InMemoryAuthIdentityManager<>(); _authIdentityManager = new CacheManagingAuthIdentityManager<>(authIdentityDAO, _cacheManager); _permissionManager = mock(PermissionManager.class); MatchingPermissionResolver permissionResolver = new MatchingPermissionResolver(); when(_permissionManager.getPermissionResolver()).thenReturn(permissionResolver); _underTest = new ApiKeyRealm("ApiKeyRealm under test", _cacheManager, _authIdentityManager, _permissionManager, null); LifecycleUtils.init(_underTest); // _permissionCaching.updatePermissions("othertestrole", new PermissionUpdateRequest().permit("city|get|Austin", "country|get|USA")); }
Example #2
Source File: CustomResolverTest.java From usergrid with Apache License 2.0 | 6 votes |
@AfterClass public static void tearDownShiro() { doClearSubject(); try { org.apache.shiro.mgt.SecurityManager securityManager = SecurityUtils.getSecurityManager(); LifecycleUtils.destroy( securityManager ); } 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 ); }
Example #3
Source File: SecurityManagerBuilder.java From emodb with Apache License 2.0 | 5 votes |
public EmoSecurityManager build() { checkNotNull(_authIdentityReader, "authIdentityManager not set"); checkNotNull(_permissionReader, "permissionManager not set"); if(_cacheManager == null) { // intended for test use _cacheManager = new GuavaCacheManager(null); } ApiKeyRealm realm = new ApiKeyRealm(_realmName, _cacheManager, _authIdentityReader, _permissionReader, _anonymousId); LifecycleUtils.init(realm); return new ApiKeySecurityManager(realm); }
Example #4
Source File: AbstractShiroTest.java From seed with Mozilla Public License 2.0 | 5 votes |
@AfterClass public static void tearDownShiro() { doClearSubject(); try { SecurityManager securityManager = getSecurityManager(); LifecycleUtils.destroy(securityManager); } 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) } setSecurityManager(null); }
Example #5
Source File: AbstractShiroTest.java From gazpachoquest with GNU General Public License v3.0 | 5 votes |
@AfterClass public static void tearDownShiro() { doClearSubject(); try { SecurityManager securityManager = getSecurityManager(); LifecycleUtils.destroy(securityManager); } 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) } setSecurityManager(null); }
Example #6
Source File: ShiroLogin.java From gazpachoquest with GNU General Public License v3.0 | 5 votes |
public static void tearDownShiro() { doClearSubject(); try { SecurityManager securityManager = getSecurityManager(); LifecycleUtils.destroy(securityManager); } 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) } setSecurityManager(null); }
Example #7
Source File: DefaultSecuritySystem.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
@Override protected void doStop() throws Exception { realmManager.stop(); LifecycleUtils.destroy(realmSecurityManager); }