• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic