Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Spring LDAP cache of credentials

  1. #11
    Join Date
    Jan 2009
    Posts
    5

    Default

    if you set pooled to false I think it would create a new connection each time (end hence not cache the creds) - I could be wrong though however

    Code:
            LdapContextSource ldapcontextsource = (LdapContextSource)ldapTemplateSUN3.getContextSource();
            //ensure credentials are not cached
            ldapcontextsource.setCacheEnvironmentProperties(false);
            ldapcontextsource.setPooled(false);
    worked for me

  2. #12
    Join Date
    Feb 2009
    Posts
    2

    Default

    Pooling is set to false per default ...

    Could this be a problem of Apache Directory Server?

    I use ApacheDS in in-memory mode for unit testing. When attaching a debugger and waiting at a breakpoint for a while (I don't know how long exactly), then I do not have the problem. Sounds like the password change is not "committed" immediately. Also on our buildserver (Hudson), I don't have the problem. Maybe because the server is so slow ...

    Additional information: Connected to the Apache Directory Server with Apache Directory Studio, I see, that the password change is done immediately.
    Last edited by bsantschi; Feb 6th, 2009 at 06:13 AM. Reason: Additional information:

  3. #13
    Join Date
    Sep 2006
    Posts
    2

    Lightbulb Setup LdapAuthenticationProvider manually to set pooled to "false"

    Hi,

    to set "pooled=false" you cannot use the security namespace configuration. Setup the bean graph youself!

    This examples works for us. Try also the PasswordComparisionAuthenticator instead of BindAuthenticator.

    Code:
      <security:authentication-manager alias="authenticationManager">
        <security:authentication-provider ref="ldapAuthenticationProvider"/>
      </security:authentication-manager>
    
      <bean id="ldapAuthenticationProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
        <constructor-arg>
          <bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
            <constructor-arg>
              <bean class="org.springframework.ldap.core.support.LdapContextSource" id="contextSource">
                <property name="url" value="ldap://ldap.xxx.de"/>
                <property name="base" value="ou=people,dc=xxx,dc=de"/>
                <property name="pooled" value="false"/>
              </bean>
            </constructor-arg>
            <property name="userDnPatterns" value="cn={0},ou=people,dc=xxx,dc=de"/>
          </bean>
        </constructor-arg>
      </bean>
    Best Regards,

    Joerg and Timmo

Posting Permissions

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