-
Dec 25th, 2012, 11:08 PM
#1
How to redirect after login
Hello folks,
I am using Spring Security 3.1.3.
I created a login page myself; when the user logs in successfully he is redirected to the "/". No prob till here..
the Login url is
localhost:8080/org/login
and after login it is
localhost:8080/org/
Now when i again enter the login url "localhost:8080/org/login" in a different tab of the same browser or put the login url in the address bar and hit enter, i again get the same login page; rather it should redirect to the already logged in page !
So how can i do this. Please help.
-
Dec 26th, 2012, 02:06 AM
#2
Technically, you are not supposed to put the login page' URL in the address bar.
The idea is that you try to get to a URL which is a 'protected resource', and then Spring redirects you to the login URL (you do not get there by your own), and then redirects you back to the 'protected resource' (after the successful login).
-
Dec 26th, 2012, 02:44 AM
#3
ok.. yeah true.. but what if a user knows and puts in the URL and hits enter he must be redirected to the protected resource. he shud not be taken to the login page again..
-
Dec 31st, 2012, 04:30 AM
#4
paste here your xml, etc, so it will be easier to help.
In addition, have a look here.
-
Dec 31st, 2012, 10:47 AM
#5
You need some logic in your login page to determine if the user is already authenticated and if so redirect them to another page. For example, if the HttpServletRequest.getRemoteUser() is not null you could redirect the user to a default page.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules