Announcement Announcement Module
Collapse
No announcement yet.
How to remember the "remember me" checkbox value? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to remember the "remember me" checkbox value?

    I'm trying to implement a login form with a "remember me" checkbox, using Spring security 3.1.

    When the credentials are invalid, I want to display back the username that was entered but I also want to check back the "remember me" checkbox, if the user checked it! I'm able to access the username with :

    Code:
    ${SPRING_SECURITY_LAST_EXCEPTION.authentication.principal}
    But I don't know how to determine if the "remember me" checkbox was checked so I can check it back! Any idea?

    Here's my jsp:

    Code:
    <form action="/login_validate" method="post">	
        username : <input type='text' id='username' name='username' value='${SPRING_SECURITY_LAST_EXCEPTION.authentication.principal}' />	
        <br />
        password : <input type='password' id='password' name='password' />
        <br />
        remember me : <input type="checkbox" name="rembme" />
        <br />
        <input type="submit" value="submit" />
    </form>
    And here's my "http" beans :

    Code:
    <http security="none" pattern="/public/**" />
    
    <http auto-config="true">
    	<intercept-url pattern="/login/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
    	<intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
    	<intercept-url pattern="/**" access="ROLE_USER, ROLE_ADMIN"/>
    	<form-login login-page="/login" 
    	            authentication-failure-url="/login?login_error=1"
    	            default-target-url="/" 
    	            username-parameter="username" 
    	            password-parameter="password"
    	            login-processing-url="/login_validate" />
    	<remember-me key="rembme" />
    </http>
Working...
X