public class LdapUserDetailsMapper extends Object implements LdapEntryMapper
Constructor and Description |
---|
LdapUserDetailsMapper() |
Modifier and Type | Method and Description |
---|---|
protected GrantedAuthority |
createAuthority(Object role)
Creates a GrantedAuthority from a role attribute.
|
Object |
mapAttributes(String dn,
Attributes attributes) |
protected String |
mapPassword(Attribute passwordAttribute)
Extension point to allow customized creation of the user's password from
the attribute stored in the directory.
|
void |
setConvertToUpperCase(boolean convertToUpperCase)
Determines whether role field values will be converted to upper case when loaded.
|
void |
setPasswordAttributeName(String passwordAttributeName)
The name of the attribute which contains the user's password.
|
void |
setRoleAttributes(String[] roleAttributes)
The names of any attributes in the user's entry which represent application
roles.
|
void |
setRolePrefix(String rolePrefix)
The prefix that should be applied to the role names
|
public Object mapAttributes(String dn, Attributes attributes) throws NamingException
mapAttributes
in interface LdapEntryMapper
NamingException
protected String mapPassword(Attribute passwordAttribute) throws NamingException
passwordAttribute
- the attribute instance containing the passwordNamingException
protected GrantedAuthority createAuthority(Object role)
The default implementation converts string attributes to roles, making use of the rolePrefix and convertToUpperCase properties. Non-String attributes are ignored.
role
- the attribute returned frompublic void setConvertToUpperCase(boolean convertToUpperCase)
convertToUpperCase
- true if the roles should be converted to upper case.public void setPasswordAttributeName(String passwordAttributeName)
passwordAttributeName
- the name of the attributepublic void setRoleAttributes(String[] roleAttributes)
roleAttributes
- the names of the role attributes.public void setRolePrefix(String rolePrefix)
rolePrefix
- the prefix (defaults to "ROLE_").Copyright © 2017. All rights reserved.