Class BasicUserDetailsContextMapper
java.lang.Object
com.appiancorp.suiteapi.common.spring.security.BasicUserDetailsContextMapper
- All Implemented Interfaces:
org.springframework.security.ldap.userdetails.UserDetailsContextMapper
public class BasicUserDetailsContextMapper
extends Object
implements org.springframework.security.ldap.userdetails.UserDetailsContextMapper
This class implements very basic conversion from a Spring LDAP
DirContextOperations
bean to a UserDetails bean. The user data is simply retrieved by invoking the
configured UserDetailsService with the given username. Conversion from
UserDetails to a DirContextAdapter is not supported.
Sample XML configuration:
<bean id="userDetailsContextMapper" class="com.appiancorp.suiteapi.common.spring.security.BasicUserDetailsContextMapper">
<constructor-arg ref="myUserDetailsService"/>
</bean>
<bean id="myUserDetailsService" class="com.example.security.auth.MyUserDetailsService"/>
-
Constructor Summary
ConstructorsConstructorDescriptionBasicUserDetailsContextMapper(org.springframework.security.core.userdetails.UserDetailsService userDetailsService) Creates a new instance with the givenUserDetailsServicewhich will be used to retrieve the user data whenmapUserFromContext(DirContextOperations, String, Collection)is invoked. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.core.userdetails.UserDetailsServiceorg.springframework.security.core.userdetails.UserDetailsmapUserFromContext(org.springframework.ldap.core.DirContextOperations ctx, String username, Collection<? extends org.springframework.security.core.GrantedAuthority> authority) Invokes theconfigured userDetailsServicewith the given username.voidmapUserToContext(org.springframework.security.core.userdetails.UserDetails user, org.springframework.ldap.core.DirContextAdapter ctx) ThrowsUnsupportedOperationException.toString()
-
Constructor Details
-
BasicUserDetailsContextMapper
public BasicUserDetailsContextMapper(org.springframework.security.core.userdetails.UserDetailsService userDetailsService) Creates a new instance with the givenUserDetailsServicewhich will be used to retrieve the user data whenmapUserFromContext(DirContextOperations, String, Collection)is invoked.
-
-
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> authority) Invokes theconfigured userDetailsServicewith the given username. The passed-in granted authorities are ignored and the ones set byUserDetailsServiceare used instead.- Specified by:
mapUserFromContextin interfaceorg.springframework.security.ldap.userdetails.UserDetailsContextMapper
-
mapUserToContext
public void mapUserToContext(org.springframework.security.core.userdetails.UserDetails user, org.springframework.ldap.core.DirContextAdapter ctx) ThrowsUnsupportedOperationException.- Specified by:
mapUserToContextin interfaceorg.springframework.security.ldap.userdetails.UserDetailsContextMapper
-
getUserDetailsService
protected org.springframework.security.core.userdetails.UserDetailsService getUserDetailsService() -
toString
-