Results 1 to 2 of 2

Thread: LDAP authentication: how to set PasswordAttributeName?

  1. #1
    Join Date
    Jul 2009
    Posts
    5

    Default LDAP authentication: how to set PasswordAttributeName?

    Hi,

    I am trying to do LDAP authentication, but the password attribute in LDAP is "userPassword".

    How do I configure this in spring security?

    I was trying to provide a UserDetailMapper as in the following codes, but then I realized that the setUserDetailsMapper is removed from AbstractLDAPAuthenticator, which BindAuthenticator inheres.

    Many thanks in advance,
    Yee

    ---------------------------------------------------------------------------------

    Code:
    <beans:bean id="userDetailsMapper" 
    class="org.springframework.security.userdetails.ldap.LdapUserDetailsMapper">
    	<beans:property name="passwordAttributeName">
    		<beans:value>userPassword</beans:value>
    	</beans:property>
    </beans:bean>
    
    <beans:bean id="bindAuthenticator" 
    class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
    	<beans:constructor-arg ref="myLdapServer" />
    	<beans:property name="userDnPatterns">
    		<beans:list>
    			<beans:value>cn={0},o=SSM</beans:value>
    		</beans:list>
    	</beans:property>
    	<beans:property name="userDetailsMapper" ref="userDetailsMapper" />
    </beans:bean>
    
    <beans:bean id="adminLdapAuthProvider"
    		class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
    	<custom-authentication-provider />
    	<beans:constructor-arg ref="bindAuthenticator" />
    	<beans:constructor-arg>
    		<beans:bean class="mypackage.MyAuthoritiesPopulator" />
    		</beans:constructor-arg>
    </beans:bean>

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    The UserDetailsContextMapper is set on the authentication provider. Take a look at the LDAP chapter in the manual.
    Spring - by Pivotal
    twitter @tekul

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •