Class CachingSecurityManager
java.lang.Object
org.apache.shiro.mgt.CachingSecurityManager
- All Implemented Interfaces:
Authenticator,Authorizer,org.apache.shiro.cache.CacheManagerAware,org.apache.shiro.event.EventBusAware,org.apache.shiro.lang.util.Destroyable,SecurityManager,SessionManager
- Direct Known Subclasses:
RealmSecurityManager
public abstract class CachingSecurityManager
extends Object
implements SecurityManager, org.apache.shiro.lang.util.Destroyable, org.apache.shiro.cache.CacheManagerAware, org.apache.shiro.event.EventBusAware
A very basic starting point for the SecurityManager interface that merely provides logging and caching
support. All actual
SecurityManager method implementations are left to subclasses.
Change in 1.0 - a default CacheManager instance is not created by default during
instantiation. As caching strategies can vary greatly depending on an application's needs, a CacheManager
instance must be explicitly configured if caching across the framework is to be enabled.- Since:
- 0.9
-
Constructor Summary
ConstructorsConstructorDescriptionDefault no-arg constructor that will automatically attempt to initialize a default cacheManager -
Method Summary
Modifier and TypeMethodDescriptionprotected voidTemplate callback to notify subclasses that aCacheManagerhas been set and is available for use via thegetCacheManager()method.protected voidTemplate callback to notify subclasses that anEventBushas been set and is available for use via thegetEventBus()method.protected voidvoiddestroy()Destroys thecacheManagerviaLifecycleUtils.destroy.org.apache.shiro.cache.CacheManagerReturns the CacheManager used by this SecurityManager.org.apache.shiro.event.EventBusReturns theEventBusused by this SecurityManager and potentially any of its children components.voidsetCacheManager(org.apache.shiro.cache.CacheManager cacheManager) Sets the CacheManager used by thisSecurityManagerand potentially any of its children components.voidsetEventBus(org.apache.shiro.event.EventBus eventBus) Sets the EventBus used by thisSecurityManagerand potentially any of its children components.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.shiro.authc.Authenticator
authenticateMethods inherited from interface org.apache.shiro.authz.Authorizer
checkPermission, checkPermission, checkPermissions, checkPermissions, checkRole, checkRoles, checkRoles, hasAllRoles, hasRole, hasRoles, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAllMethods inherited from interface org.apache.shiro.mgt.SecurityManager
createSubject, login, logoutMethods inherited from interface org.apache.shiro.session.mgt.SessionManager
getSession, start
-
Constructor Details
-
CachingSecurityManager
public CachingSecurityManager()Default no-arg constructor that will automatically attempt to initialize a default cacheManager
-
-
Method Details
-
getCacheManager
Returns the CacheManager used by this SecurityManager.- Returns:
- the cacheManager used by this SecurityManager
-
setCacheManager
Sets the CacheManager used by thisSecurityManagerand potentially any of its children components. After the cacheManager attribute has been set, the template methodafterCacheManagerSet()is executed to allow subclasses to adjust when a cacheManager is available.- Specified by:
setCacheManagerin interfaceorg.apache.shiro.cache.CacheManagerAware- Parameters:
cacheManager- the CacheManager used by thisSecurityManagerand potentially any of its children components.
-
afterCacheManagerSet
Template callback to notify subclasses that aCacheManagerhas been set and is available for use via thegetCacheManager()method. -
getEventBus
Returns theEventBusused by this SecurityManager and potentially any of its children components.- Returns:
- the
EventBusused by this SecurityManager and potentially any of its children components. - Since:
- 1.3
-
setEventBus
Sets the EventBus used by thisSecurityManagerand potentially any of its children components. After the eventBus attribute has been set, the template methodafterEventBusSet()is executed to allow subclasses to adjust when a eventBus is available.- Specified by:
setEventBusin interfaceorg.apache.shiro.event.EventBusAware- Parameters:
eventBus- the EventBus used by thisSecurityManagerand potentially any of its children components.- Since:
- 1.3
-
applyEventBusToCacheManager
- Since:
- 1.3
-
afterEventBusSet
Template callback to notify subclasses that anEventBushas been set and is available for use via thegetEventBus()method.- Since:
- 1.3
-
destroy
Destroys thecacheManagerviaLifecycleUtils.destroy.- Specified by:
destroyin interfaceorg.apache.shiro.lang.util.Destroyable
-