private Cache<Object, AuthorizationInfo> getAvailableAuthorizationCache() { Cache<Object, AuthorizationInfo> cache = getAuthorizationCache(); if (cache == null && isAuthorizationCachingEnabled()) { cache = getAuthorizationCacheLazy(); } return cache; }
private static Cache<Object, AuthorizationInfo> getAuthorizationCacheLazy(AuthorizingRealm realm) { if (realm.getAuthorizationCache() == null) { if (log.isDebugEnabled()) { log.debug("No authorizationCache instance set. Checking for a cacheManager..."); } CacheManager cacheManager = realm.getCacheManager(); if (cacheManager != null) { String cacheName = realm.getAuthorizationCacheName(); if (log.isDebugEnabled()) { log.debug("CacheManager [" + cacheManager + "] has been configured. Building " + "authorization cache named [" + cacheName + "]"); } realm.setAuthorizationCache(cacheManager.getCache(cacheName)); } else { if (log.isInfoEnabled()) { log.info("No cache or cacheManager properties have been set. Authorization cache cannot " + "be obtained."); } } } return realm.getAuthorizationCache(); }
private static Cache<Object, AuthorizationInfo> getAuthorizationCache(AuthorizingRealm realm) { Cache<Object, AuthorizationInfo> cache = realm.getAuthorizationCache(); if (cache == null && realm.isAuthorizationCachingEnabled()) { cache = getAuthorizationCacheLazy(realm); } return cache; }
/** * Looks up registered {@link AuthorizingRealm}s, and clears their authz caches if they have it set. */ private void clearAuthzRealmCaches() { // NOTE: we don't need to iterate all the Sec Managers, they use the same Realms, so one is fine. Collection<Realm> realms = realmSecurityManager.getRealms(); if (realms != null) { for (Realm realm : realms) { if (realm instanceof AuthorizingRealm) { Cache<Object, AuthorizationInfo> cache = ((AuthorizingRealm) realm).getAuthorizationCache(); if (cache != null) { log.debug("Clearing cache: {}", cache); cache.clear(); } } } } } }
private Cache<Object, AuthorizationInfo> getAvailableAuthorizationCache() { Cache<Object, AuthorizationInfo> cache = getAuthorizationCache(); if (cache == null && isAuthorizationCachingEnabled()) { cache = getAuthorizationCacheLazy(); } return cache; }
private void checkCache() { if (cache == null) { SecurityManager securityManager = SecurityUtils.getSecurityManager(); if (securityManager instanceof RealmSecurityManager) { RealmSecurityManager realmSecurityManager = (RealmSecurityManager) securityManager; AuthorizingRealm realm = findCorrectRealm(realmSecurityManager.getRealms()); if (realm != null) { cache = realm.getAuthorizationCache(); } } } }
private Cache<Object, AuthorizationInfo> getAvailableAuthorizationCache() { Cache<Object, AuthorizationInfo> cache = getAuthorizationCache(); if (cache == null && isAuthorizationCachingEnabled()) { cache = getAuthorizationCacheLazy(); } return cache; }
@Override public void clearAuthCache() { for ( Realm realm : realms ) { if ( realm instanceof AuthenticatingRealm ) { Cache<Object,AuthenticationInfo> cache = ((AuthenticatingRealm) realm).getAuthenticationCache(); if ( cache != null ) { cache.clear(); } } if ( realm instanceof AuthorizingRealm ) { Cache<Object,AuthorizationInfo> cache = ((AuthorizingRealm) realm).getAuthorizationCache(); if ( cache != null ) { cache.clear(); } } } }
private void clearRealmCaches() { // NOTE: we don't need to iterate all the Sec Managers, they use the same Realms, so one is fine. if ( this.getSecurityManager().getRealms() != null ) { for ( Realm realm : this.getSecurityManager().getRealms() ) { // check if its a AuthorizingRealm, if so clear the cache if ( AuthorizingRealm.class.isInstance( realm ) ) { // clear the cache AuthorizingRealm aRealm = (AuthorizingRealm) realm; Cache cache = aRealm.getAuthorizationCache(); if ( cache != null ) { cache.clear(); } } } } }