Spring security custom ldap authentication provider

Posted by wuntee on Stack Overflow See other posts from Stack Overflow or by wuntee
Published on 2010-04-19T22:14:58Z Indexed on 2010/06/07 8:52 UTC
Read the original article Hit count: 1005

I currently have my ldap authentication context set up like this:

    <ldap-server url="ldap://host/dn"
        manager-dn="cn=someuser"
        manager-password="somepass" />
    <authentication-manager>
        <ldap-authentication-provider user-search-filter="(samaccountname={0})"/>
    </authentication-manager> 

Now, I need to be able to set up a custom authorities mapper (it uses a different ldap server) - so I am assuming I need to set up my ldap-server similar to (http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ldap.html):

<bean id="ldapAuthProvider"
        class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
  <constructor-arg>
    <bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
      <constructor-arg ref="contextSource"/>
      <property name="userDnPatterns">
        <list><value>uid={0},ou=people</value></list>
      </property>
    </bean>
  </constructor-arg>
  <constructor-arg>
    <bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
      <constructor-arg ref="contextSource"/>
      <constructor-arg value="ou=groups"/>
      <property name="groupRoleAttribute" value="ou"/>
    </bean>
  </constructor-arg>
</bean>

But, how do I reference that 'ldapAuthProvider' to the ldap-server in the security context?

I am also using spring-security 3, so '' does not exist...

© Stack Overflow or respective owner

Related posts about authentication

Related posts about spring-security