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
ConstructorDescriptionBasicUserDetailsContextMapper
(org.springframework.security.core.userdetails.UserDetailsService userDetailsService) Creates a new instance with the givenUserDetailsService
which will be used to retrieve the user data whenmapUserFromContext(DirContextOperations, String, Collection)
is invoked. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.core.userdetails.UserDetailsService
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 userDetailsService
with the given username.void
mapUserToContext
(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 givenUserDetailsService
which 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 userDetailsService
with the given username. The passed-in granted authorities are ignored and the ones set byUserDetailsService
are used instead.- 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) ThrowsUnsupportedOperationException
.- Specified by:
mapUserToContext
in interfaceorg.springframework.security.ldap.userdetails.UserDetailsContextMapper
-
getUserDetailsService
protected org.springframework.security.core.userdetails.UserDetailsService getUserDetailsService() -
toString
-