/** * Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips. * <p/> * This property is <tt>null</tt> by default, indicating that caching is turned off. * * @param cacheManager the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching. */ public void setCacheManager(CacheManager cacheManager) { this.cacheManager = cacheManager; afterCacheManagerSet(); }
/** * If caching is enabled, this will clear any cached data associated with the specified account identity. * Subclasses are free to override for additional behavior, but be sure to call {@code super.onLogout} first. * <p/> * This default implementation merely calls {@link #clearCache(org.apache.shiro.subject.PrincipalCollection)}. * * @param principals the application-specific Subject/user identifier that is logging out. * @see #clearCache(org.apache.shiro.subject.PrincipalCollection) * @see #getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection) * @since 1.2 */ public void onLogout(PrincipalCollection principals) { clearCache(principals); }
/** * Clears out any cached data associated with the specified account identity/identities. * <p/> * This implementation will return quietly if the principals argument is null or empty. Otherwise it delegates * to {@link #doClearCache(org.apache.shiro.subject.PrincipalCollection)}. * * @param principals the principals of the account for which to clear any cached data. * @since 1.2 */ protected void clearCache(PrincipalCollection principals) { if (!isEmpty(principals)) { doClearCache(principals); log.trace("Cleared cache entries for account with principals [{}]", principals); } }
public void setName(String name) { super.setName(name); String authcCacheName = this.authenticationCacheName; if (authcCacheName != null && authcCacheName.startsWith(getClass().getName())) { //get rid of the default heuristically-created cache name. Create a more meaningful one //based on the application-unique Realm name: this.authenticationCacheName = name + DEFAULT_AUTHORIZATION_CACHE_SUFFIX; } }
/** * This implementation clears out any cached authentication data by calling * {@link #clearCachedAuthenticationInfo(org.apache.shiro.subject.PrincipalCollection)}. * If overriding in a subclass, be sure to call {@code super.doClearCache} to ensure this behavior is maintained. * * @param principals principals the principals of the account for which to clear any cached data. * @since 1.2 */ @Override protected void doClearCache(PrincipalCollection principals) { super.doClearCache(principals); clearCachedAuthenticationInfo(principals); }
@Override public void shutdown() throws Throwable { for ( Realm realm : realms ) { if ( realm instanceof CachingRealm ) { ((CachingRealm) realm).setCacheManager( null ); } if ( realm instanceof RealmLifecycle ) { ((RealmLifecycle) realm).shutdown(); } } }
public void onExpiration(Session session) { LOGGER.debug("session onExpiration ID: " + session.getId()); this.sessionDAO.delete(session); this.cachingRealms.forEach(o -> o.onLogout(SecurityUtils.getSubject().getPrincipals())); } }
public void setName(String name) { super.setName(name); String authcCacheName = this.authenticationCacheName; if (authcCacheName != null && authcCacheName.startsWith(getClass().getName())) { //get rid of the default heuristically-created cache name. Create a more meaningful one //based on the application-unique Realm name: this.authenticationCacheName = name + DEFAULT_AUTHORIZATION_CACHE_SUFFIX; } }
/** * This implementation clears out any cached authentication data by calling * {@link #clearCachedAuthenticationInfo(org.apache.shiro.subject.PrincipalCollection)}. * If overriding in a subclass, be sure to call {@code super.doClearCache} to ensure this behavior is maintained. * * @param principals principals the principals of the account for which to clear any cached data. * @since 1.2 */ @Override protected void doClearCache(PrincipalCollection principals) { super.doClearCache(principals); clearCachedAuthenticationInfo(principals); }
@Override public void init() throws Throwable { for ( Realm realm : realms ) { if ( realm instanceof Initializable ) { ((Initializable) realm).init(); } if ( realm instanceof CachingRealm ) { ((CachingRealm) realm).setCacheManager( cacheManager ); } if ( realm instanceof RealmLifecycle ) { ((RealmLifecycle) realm).initialize(); } } }
/** * Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips. * <p/> * This property is <tt>null</tt> by default, indicating that caching is turned off. * * @param cacheManager the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching. */ public void setCacheManager(CacheManager cacheManager) { this.cacheManager = cacheManager; afterCacheManagerSet(); }
/** * Clears out any cached data associated with the specified account identity/identities. * <p/> * This implementation will return quietly if the principals argument is null or empty. Otherwise it delegates * to {@link #doClearCache(org.apache.shiro.subject.PrincipalCollection)}. * * @param principals the principals of the account for which to clear any cached data. * @since 1.2 */ protected void clearCache(PrincipalCollection principals) { if (!isEmpty(principals)) { doClearCache(principals); log.trace("Cleared cache entries for account with principals [{}]", principals); } }
/** * If caching is enabled, this will clear any cached data associated with the specified account identity. * Subclasses are free to override for additional behavior, but be sure to call {@code super.onLogout} first. * <p/> * This default implementation merely calls {@link #clearCache(org.apache.shiro.subject.PrincipalCollection)}. * * @param principals the application-specific Subject/user identifier that is logging out. * @see #clearCache(org.apache.shiro.subject.PrincipalCollection) * @see #getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection) * @since 1.2 */ public void onLogout(PrincipalCollection principals) { clearCache(principals); }
/** * Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips. * <p/> * <p>This property is <tt>null</tt> by default, indicating that caching is turned off. * * @param cacheManager the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching. */ public void setCacheManager(CacheManager cacheManager) { this.cacheManager = cacheManager; afterCacheManagerSet(); }