Package org.apache.shiro.mgt
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,SecurityManager,SessionManager,org.apache.shiro.util.Destroyable
- Direct Known Subclasses:
AuthenticatingSecurityManager
public abstract class RealmSecurityManager extends CachingSecurityManager
Shiro support of aSecurityManagerclass hierarchy based around a collection ofRealms. All actualSecurityManagermethod implementations are left to subclasses.- Since:
- 0.9
-
-
Constructor Summary
Constructors Constructor Description RealmSecurityManager()Default no-arg constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterCacheManagerSet()Simply callsapplyCacheManagerToRealms()to allow the newly setCacheManagerto be propagated to the internal collection ofRealmthat would need to use it.protected voidafterEventBusSet()Template callback to notify subclasses that anEventBushas been set and is available for use via thegetEventBus()method.protected voidafterRealmsSet()protected voidapplyCacheManagerToRealms()Sets the internalCacheManageron any internal configuredRealmsthat implement theCacheManagerAwareinterface.protected voidapplyEventBusToRealms()voiddestroy()Destroys thecacheManagerviaLifecycleUtils.destroy.Collection<Realm>getRealms()Returns theRealms managed by this SecurityManager instance.voidsetRealm(Realm realm)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.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, setEventBus
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.shiro.authc.Authenticator
authenticate
-
Methods inherited from interface org.apache.shiro.authz.Authorizer
checkPermission, checkPermission, checkPermissions, checkPermissions, checkRole, checkRoles, checkRoles, hasAllRoles, hasRole, hasRoles, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll
-
Methods inherited from interface org.apache.shiro.mgt.SecurityManager
createSubject, login, logout
-
Methods inherited from interface org.apache.shiro.session.mgt.SessionManager
getSession, start
-
-
-
-
Method Detail
-
setRealm
public void setRealm(Realm realm)
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
public void setRealms(Collection<Realm> realms)
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
protected void afterRealmsSet()
-
getRealms
public Collection<Realm> getRealms()
Returns theRealms managed by this SecurityManager instance.- Returns:
- the
Realms managed by this SecurityManager instance.
-
applyCacheManagerToRealms
protected void 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
protected void 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
protected void afterCacheManagerSet()
Simply callsapplyCacheManagerToRealms()to allow the newly setCacheManagerto be propagated to the internal collection ofRealmthat would need to use it.- Overrides:
afterCacheManagerSetin classCachingSecurityManager
-
afterEventBusSet
protected void 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
public void destroy()
Description copied from class:CachingSecurityManagerDestroys thecacheManagerviaLifecycleUtils.destroy.- Specified by:
destroyin interfaceorg.apache.shiro.util.Destroyable- Overrides:
destroyin classCachingSecurityManager
-
-