Is there a way in spring security 3 to redirect the user to a different page rather than the user account page if cookies are disabled on the browser?
Just like gmail does. As it redirects the user to a different page than the user account page and force user to enable cookies.
What I want is to force the user to enable cookies before he lands on his account page.
Thanks.
To handle cookies you can use a handler servlet for viewing cookie details. To do this you need to prepare your login form manually and if condition matches with your requirements than forward to /j_spring_security_check. I have just used simple validation on embedded cookie in the request. In the below example servlet, I have checked if request contains any cookie if not I have forwarded page to cookieDisabled.jsp
web-xml for handler:
if you have secured all urls then you need to add below tag into security.xml as below:
And in your login form you need to post request to cookieHandler instead of j_spring_security_check:
Process quite similar with JSF (if you are using) as you handle login via servlet dispatcher.