0

I'm trying to cofigure "remember-me" in my web app. I use Spring security 3.1, LDAP and ActiveDirectory.
This is applicationcontext-security.xml:

<!-- LDAP server details -->
<authentication-manager>
    <authentication-provider ref="ldapActiveDirectoryAuthProvider" />
</authentication-manager>

<!-- enable security tag libraries on jsp pages -->
<beans:bean id="grantedAuthoritiesMapper" class="xxcutxx.spring.security.ActiveDirectoryGrantedAuthoritiesMapper"/>

<beans:bean id="ldapActiveDirectoryAuthProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
    <beans:constructor-arg value="xxcutxx" />
    <beans:constructor-arg value="xxcutxx" />
    <beans:property name="authoritiesMapper" ref="grantedAuthoritiesMapper" />
    <beans:property name="useAuthenticationRequestCredentials" value="true" />
    <beans:property name="convertSubErrorCodesToExceptions" value="true" />
</beans:bean>

<http pattern="/index.jsp*" security="none"/>
<http pattern="/img/**" security="none"/>
<http pattern="/css/**" security="none"/>
<http pattern="/js/**" security="none"/>   

<beans:bean id="successHandler" class="xxcutxx.spring.security.CustomAuthenticationSuccessHandler"/>

<beans:bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>

 <http  access-decision-manager-ref="accessDecisionManager" auto-config="true" pattern="/**"> <!--"-->
    <!-- Login pages -->
    <form-login login-page="/index.jsp" default-target-url="xxcutxx" authentication-success-handler-ref="successHandler"
        login-processing-url="/j_spring_security_check" authentication-failure-url="/index.jsp?loginerr=1" />
    <logout logout-success-url="/index.jsp"/>
    <access-denied-handler error-page="/index.jsp?loginerr=3"/>
    <intercept-url pattern="/*.do" access="READER" />

    <remember-me key="MY_REMEMBER_ME_KEY" services-ref="rememberMeServices"/>

</http>

And this is applicationcontext.xml:

<bean id="rememberMeServices" class="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices">
    <property name="key" value="MY_REMEMBER_ME_KEY" />
    <property name="cookieName" value="MY_REMEMBER_ME_COOKIE" />
    <property name="parameter" value="remember" />
    <property name="tokenValiditySeconds" value="1209600" />    
    <property name="userDetailsService" ref="MyUserDetailsService" />
    <property name="alwaysRemember" value="false" />
</bean>

<bean id="MyUserDetailsService" class="org.springframework.security.ldap.userdetails.LdapUserDetailsService">
    <constructor-arg index="0" ref="ldapUserSearch"/>
</bean>

<bean id="ldapUserSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
    <constructor-arg index="0" type="String">
        <value>
            xxcutxx
        </value>
    </constructor-arg>
    <constructor-arg index="1" type="String" value="(objectCategory=Person)">
    </constructor-arg>
    <constructor-arg index="2" ref="ldapPoolContext"/>
</bean>

<bean id="ldapPoolContext" class="org.springframework.ldap.core.support.LdapContextSource">
    <property name="url" value="xxcutxx"/>
    <property name="pooled" value="false"/>
</bean>

The web app starts but don't create the cookie and seems remember me does not work.
Where is the error and/or something is missing? i don't understand what i must to do
THX for HELP!!

Diego87
  • 1,617
  • 3
  • 17
  • 20
  • Difficult to say unless you provide some more information. Check the debug log. – Shaun the Sheep Aug 07 '14 at 13:42
  • debug log seems ok, maybe is impossible what am i trying to do(without a persistent db)? can i save the username and the passw encrypted in the cookie and in the next reboot read and authenticate automatically? – Diego87 Aug 08 '14 at 08:30

0 Answers0