Package com.almis.awe.service.user
Class LdapAweUserDetailsMapper
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.user.LdapAweUserDetailsMapper
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.security.ldap.userdetails.UserDetailsContextMapper
public class LdapAweUserDetailsMapper
extends ServiceConfig
implements org.springframework.security.ldap.userdetails.UserDetailsContextMapper
Custom ldap user details mapper
Used to set UserDetails
-
Constructor Summary
ConstructorDescriptionLdapAweUserDetailsMapper
(org.springframework.security.core.userdetails.UserDetailsService userDetailService) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.userdetails.UserDetails
mapUserFromContext
(org.springframework.ldap.core.DirContextOperations ctx, String username, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities) void
mapUserToContext
(org.springframework.security.core.userdetails.UserDetails user, org.springframework.ldap.core.DirContextAdapter ctx) 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 namesMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
Constructor Details
-
LdapAweUserDetailsMapper
public LdapAweUserDetailsMapper(org.springframework.security.core.userdetails.UserDetailsService userDetailService) Autowired constructor- Parameters:
userDetailService
- AWE user detaill service
-
-
Method Details
-
mapUserFromContext
public org.springframework.security.core.userdetails.UserDetails mapUserFromContext(org.springframework.ldap.core.DirContextOperations ctx, String username, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities) - Specified by:
mapUserFromContext
in interfaceorg.springframework.security.ldap.userdetails.UserDetailsContextMapper
-
mapUserToContext
public void mapUserToContext(org.springframework.security.core.userdetails.UserDetails user, org.springframework.ldap.core.DirContextAdapter ctx) - Specified by:
mapUserToContext
in interfaceorg.springframework.security.ldap.userdetails.UserDetailsContextMapper
-
setConvertToUpperCase
public void setConvertToUpperCase(boolean convertToUpperCase) Determines whether role field values will be converted to upper case when loaded. The default is true.- Parameters:
convertToUpperCase
- true if the roles should be converted to upper case.
-
setPasswordAttributeName
The name of the attribute which contains the user's password. Defaults to "userPassword".- Parameters:
passwordAttributeName
- the name of the attribute
-
setRoleAttributes
The names of any attributes in the user's entry which represent application roles. These will be converted to GrantedAuthorities and added to the list in the returned LdapUserDetails object. The attribute values must be Strings by default.- Parameters:
roleAttributes
- the names of the role attributes.
-
setRolePrefix
The prefix that should be applied to the role names- Parameters:
rolePrefix
- the prefix (defaults to "ROLE_").
-