aspose file tools*
The moose likes Spring and the fly likes Spring Security 2.0.4 .... Redirect user to original page after authentication success or failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Security 2.0.4 .... Redirect user to original page after authentication success or failure" Watch "Spring Security 2.0.4 .... Redirect user to original page after authentication success or failure" New topic
Author

Spring Security 2.0.4 .... Redirect user to original page after authentication success or failure

Anoop Nair
Ranch Hand

Joined: Oct 29, 2008
Posts: 70
Hi All,

I have a web app which has a login form on all the pages.

I am using spring 2.5 .

After the login happens (whether successs or failure) the user should be redirected back to the same page. Can someone please tell me how to go about implementing this ?

Below are my files:

Spring XML file:


Authentication Class


Login form



The login form is present on all the pages and the user should be redirected to the page he was viewing after login success/failure.


Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

This happens automatically. But I noticed you had default-target-url, which to me says after logging in send them to that page. If you remove it it should redirect them back to the page they tried to view, unless they enter invalid login stuff. which takes them to the general/home page

<security:form-login login-page="/loginURL"
login-processing-url="/loginURL"
authentication-failure-url="/general/home?login_error=true"
default-target-url="/general/home"/>

I would recheck the attributes to make sure they mean what you expect them to mean. I think you possibly just copied and pasted this from somewhere else expecting it to work correctly without understanding what it all meant.

Good Luck

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Security 2.0.4 .... Redirect user to original page after authentication success or failure
 
Similar Threads
No AuthenticationEntryPoint could be established
"Spring Security Application" Initiated by Apache
No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
Bypass login form on a Spring application
spring security form based login using database not responding