Class RealmSecurityManager
java.lang.Object
org.apache.shiro.mgt.CachingSecurityManager
org.apache.shiro.mgt.RealmSecurityManager
- 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:
AuthenticatingSecurityManager
Shiro support of a
SecurityManager class hierarchy based around a collection of
Realms. All actual SecurityManager method implementations are left to
subclasses.- Since:
- 0.9
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSimply callsapplyCacheManagerToRealms()to allow the newly setCacheManagerto be propagated to the internal collection ofRealmthat would need to use it.protected voidTemplate callback to notify subclasses that anEventBushas been set and is available for use via thegetEventBus()method.protected voidprotected voidSets the internalCacheManageron any internal configuredRealmsthat implement theCacheManagerAwareinterface.protected voidvoiddestroy()Destroys thecacheManagerviaLifecycleUtils.destroy.Returns theRealms managed by this SecurityManager instance.voidConvenience method for applications using a single realm that merely wraps the realm in a list and then invokes thesetRealms(java.util.Collection<org.apache.shiro.realm.Realm>)method.voidsetRealms(Collection<Realm> realms) Sets the realms managed by this SecurityManager instance.Methods inherited from class org.apache.shiro.mgt.CachingSecurityManager
applyEventBusToCacheManager, getCacheManager, getEventBus, setCacheManager, setEventBusMethods 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
-
RealmSecurityManager
public RealmSecurityManager()Default no-arg constructor.
-
-
Method Details
-
setRealm
Convenience method for applications using a single realm that merely wraps the realm in a list and then invokes thesetRealms(java.util.Collection<org.apache.shiro.realm.Realm>)method.- Parameters:
realm- the realm to set for a single-realm application.- Since:
- 0.2
-
setRealms
Sets the realms managed by this SecurityManager instance.- Parameters:
realms- the realms managed by this SecurityManager instance.- Throws:
IllegalArgumentException- if the realms collection is null or empty.
-
afterRealmsSet
-
getRealms
-
applyCacheManagerToRealms
Sets the internalCacheManageron any internal configuredRealmsthat implement theCacheManagerAwareinterface. This method is called after setting a cacheManager on this securityManager via thesetCacheManagermethod to allow it to be propagated down to all the internal Realms that would need to use it. It is also called after setting one or more realms via thesetRealmorsetRealmsmethods to allow these newly available realms to be given the cache manager already in use. -
applyEventBusToRealms
Sets the internalEventBuson any internal configuredRealmsthat implement theEventBusAwareinterface. This method is called after setting an eventBus on this securityManager via thesetEventBusmethod to allow it to be propagated down to all the internal Realms that would need to use it. It is also called after setting one or more realms via thesetRealmorsetRealmsmethods to allow these newly available realms to be given the EventBus already in use.- Since:
- 1.3
-
afterCacheManagerSet
Simply callsapplyCacheManagerToRealms()to allow the newly setCacheManagerto be propagated to the internal collection ofRealmthat would need to use it.- Overrides:
afterCacheManagerSetin classCachingSecurityManager
-
afterEventBusSet
Description copied from class:CachingSecurityManagerTemplate callback to notify subclasses that anEventBushas been set and is available for use via thegetEventBus()method.- Overrides:
afterEventBusSetin classCachingSecurityManager
-
destroy
Description copied from class:CachingSecurityManagerDestroys thecacheManagerviaLifecycleUtils.destroy.- Specified by:
destroyin interfaceorg.apache.shiro.lang.util.Destroyable- Overrides:
destroyin classCachingSecurityManager
-