Class AuthenticatingSecurityManager
java.lang.Object
org.apache.shiro.mgt.CachingSecurityManager
org.apache.shiro.mgt.RealmSecurityManager
org.apache.shiro.mgt.AuthenticatingSecurityManager
- 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:
AuthorizingSecurityManager
Shiro support of a
SecurityManager class hierarchy that delegates all
authentication operations to a wrapped Authenticator instance. That is, this class
implements all the Authenticator methods in the SecurityManager
interface, but in reality, those methods are merely passthrough calls to the underlying 'real'
Authenticator instance.
All other SecurityManager (authorization, session, etc.) methods are left to be implemented by subclasses.
In keeping with the other classes in this hierarchy and Shiro's desire to minimize configuration whenever possible, suitable default instances for all dependencies are created upon instantiation.
- Since:
- 0.9
-
Constructor Summary
ConstructorsConstructorDescriptionDefault no-arg constructor that initializes its internalauthenticatorinstance to aModularRealmAuthenticator. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPasses on therealmsto the internal delegateAuthenticatorinstance so that it may use them during authentication attempts.authenticate(AuthenticationToken token) Delegates to the wrappedAuthenticatorfor authentication.voiddestroy()Destroys thecacheManagerviaLifecycleUtils.destroy.Returns the delegateAuthenticatorinstance that this SecurityManager uses to perform all authentication operations.voidsetAuthenticator(Authenticator authenticator) Sets the delegateAuthenticatorinstance that this SecurityManager uses to perform all authentication operations.Methods inherited from class org.apache.shiro.mgt.RealmSecurityManager
afterCacheManagerSet, afterEventBusSet, applyCacheManagerToRealms, applyEventBusToRealms, getRealms, setRealm, setRealmsMethods 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.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
-
AuthenticatingSecurityManager
public AuthenticatingSecurityManager()Default no-arg constructor that initializes its internalauthenticatorinstance to aModularRealmAuthenticator.
-
-
Method Details
-
getAuthenticator
Returns the delegateAuthenticatorinstance that this SecurityManager uses to perform all authentication operations. Unless overridden by thesetAuthenticator, the default instance is aModularRealmAuthenticator.- Returns:
- the delegate
Authenticatorinstance that this SecurityManager uses to perform all authentication operations.
-
setAuthenticator
Sets the delegateAuthenticatorinstance that this SecurityManager uses to perform all authentication operations. Unless overridden by this method, the default instance is aModularRealmAuthenticator.- Parameters:
authenticator- the delegateAuthenticatorinstance that this SecurityManager will use to perform all authentication operations.- Throws:
IllegalArgumentException- if the argument isnull.
-
afterRealmsSet
Passes on therealmsto the internal delegateAuthenticatorinstance so that it may use them during authentication attempts.- Overrides:
afterRealmsSetin classRealmSecurityManager
-
authenticate
Delegates to the wrappedAuthenticatorfor authentication.- Parameters:
token- any representation of a user's principals and credentials submitted during an authentication attempt.- Returns:
- the AuthenticationInfo representing the authenticating user's account data.
- Throws:
AuthenticationException- if there is any problem during the authentication process. See the specific exceptions listed below to as examples of what could happen in order to accurately handle these problems and to notify the user in an appropriate manner why the authentication attempt failed. Realize an implementation of this interface may or may not throw those listed or may throw other AuthenticationExceptions, but the list shows the most common ones.- See Also:
-
destroy
Description copied from class:CachingSecurityManagerDestroys thecacheManagerviaLifecycleUtils.destroy.- Specified by:
destroyin interfaceorg.apache.shiro.lang.util.Destroyable- Overrides:
destroyin classRealmSecurityManager
-