public class PolicyBasedAuthenticationManager extends Object implements AuthenticationManager
AuthenticationPolicy component. The authentication process is as follows:
setAuthenticationPolicy(AuthenticationPolicy) is applied.
In all cases AuthenticationException is raised if security policy is not met.
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
Log instance for logging events, errors, warnings, etc.
|
AUTHENTICATION_METHOD_ATTRIBUTE| Constructor and Description |
|---|
PolicyBasedAuthenticationManager(AuthenticationHandler... handlers)
Creates a new authentication manager with a varargs array of authentication handlers that are attempted in the
listed order for supported credentials.
|
PolicyBasedAuthenticationManager(List<AuthenticationHandler> handlers)
Creates a new authentication manager with a list of authentication handlers that are attempted in the
listed order for supported credentials.
|
PolicyBasedAuthenticationManager(Map<AuthenticationHandler,PrincipalResolver> map)
Creates a new authentication manager with a map of authentication handlers to the principal resolvers that
should be used upon successful authentication if no principal is resolved by the authentication handler.
|
| Modifier and Type | Method and Description |
|---|---|
Authentication |
authenticate(Credential... credentials)
Authenticates the provided credentials.
|
protected AuthenticationBuilder |
authenticateInternal(Credential... credentials)
Follows the same contract as
AuthenticationManager.authenticate(Credential...). |
protected Principal |
resolvePrincipal(String handlerName,
PrincipalResolver resolver,
Credential credential) |
void |
setAuthenticationMetaDataPopulators(List<AuthenticationMetaDataPopulator> populators)
Sets the authentication metadata populators that will be applied to every successful authentication event.
|
void |
setAuthenticationPolicy(AuthenticationPolicy policy)
Sets the authentication policy used by this component.
|
protected final org.slf4j.Logger logger
public PolicyBasedAuthenticationManager(AuthenticationHandler... handlers)
handlers - One or more authentication handlers.public PolicyBasedAuthenticationManager(List<AuthenticationHandler> handlers)
handlers - Non-null list of authentication handlers containing at least one entry.public PolicyBasedAuthenticationManager(Map<AuthenticationHandler,PrincipalResolver> map)
LinkedHashMap) should be used.map - Non-null map of authentication handler to principal resolver containing at least one entry.public final Authentication authenticate(Credential... credentials) throws AuthenticationException
Authentication object
is returned containing metadata about the result of each authenticated credential.
Note that a particular implementation may require some or all credentials to be
successfully authenticated. Failure to authenticate is considered an exceptional case, and
an AuthenticationException is thrown.authenticate in interface AuthenticationManagercredentials - One or more credentials to authenticate.AuthenticationException - On authentication failure. The exception contains details
on each of the credentials that failed to authenticate.public final void setAuthenticationMetaDataPopulators(List<AuthenticationMetaDataPopulator> populators)
populators - Non-null list of metadata populators.public void setAuthenticationPolicy(AuthenticationPolicy policy)
policy - Non-null authentication policy. The default policy is AnyAuthenticationPolicy.protected AuthenticationBuilder authenticateInternal(Credential... credentials) throws AuthenticationException
AuthenticationManager.authenticate(Credential...).credentials - One or more credentials to authenticate.AuthenticationException - When one or more credentials failed authentication such that security policy
was not satisfied.protected Principal resolvePrincipal(String handlerName, PrincipalResolver resolver, Credential credential)
Copyright © 2004-2014 Jasig. All Rights Reserved.