Announcement Announcement Module
Collapse
No announcement yet.
ActiveDirectoryLdapAuthenticationProvider and Remember-Me functionality Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ActiveDirectoryLdapAuthenticationProvider and Remember-Me functionality

    Hi,

    i use the ActiveDirectoryLdapAuthenticationProvider in Spring 3.1 which works fine.
    Now I want to use a remember-me functionality on the login page of my webapp.

    Code:
    <s:http auto-config="true" use-expressions="true">
    	<s:intercept-url pattern="/**" access="isAuthenticated()" />
    	<s:remember-me />
    	<s:form-login />
    	<s:anonymous />
    	<s:logout />
    </s:http>
    Remember-me functionality needs a UserDetailsService.

    Code:
    <bean id="userDetailsService" class="org.springframework.security.ldap.userdetails.LdapUserDetailsService">
            <constructor-arg index="0" ref="ldapUserSearch"/>
    </bean>
    LdapUserDetailsService needs an UserSearch. There is a FilterBasedLdapUserSearch which needs a BaseLdapPathContextSource. I don't know how I "wire" this with the ActiveDirectoryLdapAuthenticationProvider (or am I missing something?). Can you give me a hint?

    http://static.springsource.org/sprin...serSearch.html
    Last edited by morb; Feb 7th, 2012, 08:22 AM.

  • #2
    I have the same issue here. Can someone help

    Comment


    • #3
      It seems like there is no other solution than to additonally create your own ContextSource.

      If your AuthenticationProvider looks like this:
      Code:
      <bean id="authenticationProvider"
      		class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider" >
      		<constructor-arg value="asdf.com" />
      		<constructor-arg value="ldap://asdf.com" />
      	</bean>
      You can easily create a ContextSource. aUser is a (manager) user to perform queries on the AD (unless anonymous binding in your AD is enabled)
      Code:
      	<bean id="contextSource"
      		class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
      		<constructor-arg value="ldap://asdf.com/DC=asdf,DC=de" />
      		<property name="userDn" value="CN=aUser,CN=Users,DC=asdf,DC=com" />
      		<property name="password" value="asdf" />
      	</bean>
      
      	<bean id="userSearch"
      		class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
      		<constructor-arg index="0" value="" />
      		<constructor-arg index="1" value="(cn={0})" />
      		<constructor-arg index="2" ref="contextSource" />
      	</bean>
      I haven't tried it with Remember-Me functionality, but I'm able to perform queries with this.
      Last edited by morb; Feb 22nd, 2012, 02:54 AM.

      Comment

      Working...
      X