• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Redirecting back to previous page after successful login

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have created a web application that contains spring security. Some of the pages are protected, so that the user has to be logged in
inorder to see the pages. If a user is not logged in and tries to access one of the restricted pages, he is taken to the login screen.

I would like the user to be taken back to the original protected page after he has succ logged in.

I have the following configurations:-




login.xhtml
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is happening currently?
Is it going to your default-target-url?
 
Janes Smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prasad,
thanks for getting back to me.
After being directed to the login page, from a protected page, the user enters username/password and is the succ authenticated. The user is then forward to the home page.
I would like the user to be forward back to the protected page, if that is possible.

Janes

 
Saloon Keeper
Posts: 24305
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That capability is automatically provided by the J2EE standard container login mechanism, which, when presented with a secured URL for a non-authenticated user initiates a login process at the server level, and only if the user logs in successfully transparently resumes the original request.

Spring security does have the ability to work in concert with this mechanism, although I have no specific details on this, as I usually don't need the extra protections of Spring Security myself. I have seen products that did, however.
 
Janes Smith
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim and Prasad,
would one of you be able to provide an example of integrating such a feature into the spring security configuration that I'm currently using.
It seems as though it should be a standard feature of spring security.

Janes
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but you need to tell us more details, first has i said, tell me what happens currently, is it going to default url page?
Also, post spring security logs with DEBUG enabled.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic