Results 1 to 5 of 5

Thread: Remember-me no longer works after moving from 2.0 to 3.0.1.RELEASE

  1. #1

    Default Remember-me no longer works after moving from 2.0 to 3.0.1.RELEASE

    I had been working with a small test project using spring-sec 2 and spring 2.5.6 to learn spring security. I had a basic setup working, including working 'remember-me' configured with defaults. I have just moved to spring-sec-3.0.1.RELEASE and spring-3.0.RELEASE and everything works EXCEPT remember-me. I used the docs and the contacts sample app to convert the config to 3.0 - now I can see that a cookie IS being set in the server logs:

    1699060847@qtp-327325694-0 2010-01-21 13:16:37,810 DEBUG [TokenBasedRememberMeServices:onLoginSuccess] Added remember-me cookie for user 'user', expiry: 'Thu Feb 04 13:16:37 PST 2010'

    I can also see the cookie when I 'show cookies' from the browser.

    However, when I close the browser, reopen it, and attempt to navigate to a secure page, I am always prompted to login. There is no entry in the log indicating that the remember-me cookie is ever processed.

    My security configh looks like this:

    Code:
    <security:http auto-config="true" access-denied-page="/login.html?login_error=1">
        <security:intercept-url pattern="/methods/*" access="ROLE_USER"/>
        <security:intercept-url pattern="/main.html" access="ROLE_USER"/>
        <security:intercept-url pattern="/login.html" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <security:intercept-url pattern="/home.html" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <security:form-login login-page="/login.html" authentication-failure-url="/login.html?login_error=1" default-target-url="/main.html"/>
        <security:logout logout-success-url="/home.html"/>
        <security:remember-me />
    </security:http>
    <security:authentication-manager>
        <security:authentication-provider>
            <security:password-encoder hash="md5"/>
            <security:user-service>
                <security:user name="admin" password="70448f05afcfa5006cd384c52c3317b2" authorities="ROLE_ADMIN, ROLE_USER" />
                <security:user name="user" password="d5598909146844d313a806e2cec6b38d" authorities="ROLE_USER" />
            </security:user-service>
        </security:authentication-provider>
    </security:authentication-manager>
    The filters in web.xml are configured as such:

    Code:
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    I am using a custom login form like this:

    Code:
    <form name="f" action="<c:url value='j_spring_security_check'/>" method="POST">
        <h2>Please log in:</h2>
        <table cellpadding="3">
            <tr><td>User:</td><td><input id="j_username" type="text" name="j_username" value="<c:if test='${not empty param.login_error}'><c:out value='${SPRING_SECURITY_LAST_USERNAME}'/></c:if>"/></td></tr>
            <tr><td>Password:</td><td><input type="password" name="j_password"></td></tr>
            <tr><td align="right"><input type="checkbox" name="_spring_security_remember_me">&nbsp;</td><td>Don't ask for my password for two weeks</td></tr>
            <tr><td colspan="2" align="center">&nbsp;</td></tr>
        </table>
        <div style="text-align: center; width:100%; margin: auto"><input name="submit" type="submit"> <input name="reset" type="reset"></div>
    </form>
    I must be missing some configuration of 3.0.1 but I simply can't figure out what, it seems like I've got 'remember-me' only half configured, how do you make spring-sec-3 pay attention to the cookie once it is set?

    Thanks in advance for any help.

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

    Default

    Yeah, it's broken in 3.0.1. I will put out a 3.0.2 release at the weekend or next week. Until then you're better off sticking with 3.0.0.
    Spring - by Pivotal
    twitter @tekul

  3. #3
    Join Date
    Jan 2010
    Location
    Lanus, Argentina
    Posts
    28

    Default

    Excuse me, Luke...
    But I couldn't find this bug in JIRA....is it posted there?
    The point is that I want to vote for it, because I've got the same problem as wblackburniv.
    Thanks

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

    Default

    It's already fixed and will be in 3.0.2. You should be able to use 3.0.0 in the meantime.
    Spring - by Pivotal
    twitter @tekul

  5. #5
    Join Date
    Jan 2010
    Location
    Lanus, Argentina
    Posts
    28

    Default

    Thanks for the good news Luke!

Posting Permissions

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