public class LdapAuthenticationHandler extends AbstractUsernamePasswordAuthenticationHandler
Authenticator component underneath.
This handler provides simple attribute resolution machinery by reading attributes from the entry
corresponding to the DN of the bound user (in the bound security context) upon successful authentication.
Principal resolution is controlled by the following properties:
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
additionalAttributes
List of additional attributes to be fetched but are not principal attributes.
|
protected Map<String,String> |
principalAttributeMap
Mapping of LDAP attribute name to principal attribute name.
|
logger| Constructor and Description |
|---|
LdapAuthenticationHandler(org.ldaptive.auth.Authenticator authenticator)
Creates a new authentication handler that delegates to the given authenticator.
|
| Modifier and Type | Method and Description |
|---|---|
protected HandlerResult |
authenticateUsernamePasswordInternal(UsernamePasswordCredential upc) |
protected Principal |
createPrincipal(String username,
org.ldaptive.LdapEntry ldapEntry)
Creates a CAS principal with attributes if the LDAP entry contains principal attributes.
|
String |
getName() |
void |
initialize() |
void |
setAdditionalAttributes(List<String> additionalAttributes)
Sets the list of additional attributes to be fetched from the user entry during authentication.
|
void |
setAllowMultiplePrincipalAttributeValues(boolean allowed)
Sets a flag that determines whether multiple values are allowed for the
principalIdAttribute. |
void |
setName(String name)
Sets the component name.
|
void |
setPrincipalAttributeMap(Map<String,String> attributeNameMap)
Sets the mapping of additional principal attributes where the key is the LDAP attribute
name and the value is the principal attribute name.
|
void |
setPrincipalIdAttribute(String attributeName)
Sets the name of the LDAP principal attribute whose value should be used for the
principal ID.
|
boolean |
supports(Credential credential) |
createHandlerResult, doAuthentication, getPasswordEncoder, getPasswordPolicyConfiguration, getPrincipalNameTransformer, setPasswordEncoder, setPasswordPolicyConfiguration, setPrincipalNameTransformerauthenticate, postAuthenticate, preAuthenticate@NotNull protected Map<String,String> principalAttributeMap
public LdapAuthenticationHandler(@NotNull
org.ldaptive.auth.Authenticator authenticator)
authenticator - Ldaptive authenticator component.public void setName(String name)
setName in class AbstractAuthenticationHandlername - Authentication handler name.public void setPrincipalIdAttribute(String attributeName)
attributeName - LDAP attribute name.public void setAllowMultiplePrincipalAttributeValues(boolean allowed)
principalIdAttribute.
This flag only has an effect if principalIdAttribute is configured. If multiple values are detected
when the flag is false, the first value is used and a warning is logged. If multiple values are detected
when the flag is true, an exception is raised.allowed - True to allow multiple principal ID attribute values, false otherwise.public void setPrincipalAttributeMap(Map<String,String> attributeNameMap)
attributeNameMap - Map of LDAP attribute name to principal attribute name.public void setAdditionalAttributes(List<String> additionalAttributes)
A common use case for these attributes is to support password policy machinery.
additionalAttributes - List of operational attributes to fetch when resolving an entry.protected HandlerResult authenticateUsernamePasswordInternal(UsernamePasswordCredential upc) throws GeneralSecurityException, PreventedException
authenticateUsernamePasswordInternal in class AbstractUsernamePasswordAuthenticationHandlerGeneralSecurityExceptionPreventedExceptionpublic boolean supports(Credential credential)
supports in interface AuthenticationHandlersupports in class AbstractUsernamePasswordAuthenticationHandlerpublic String getName()
getName in interface AuthenticationHandlergetName in class AbstractAuthenticationHandlerprotected Principal createPrincipal(String username, org.ldaptive.LdapEntry ldapEntry) throws LoginException
username - Username that was successfully authenticated which is used for principal ID when
setPrincipalIdAttribute(String) is not specified.ldapEntry - LDAP entry that may contain principal attributes.LoginException - On security policy errors related to principal creation.@PostConstruct public void initialize()
Copyright © 2004-2015 Jasig. All Rights Reserved.