Results 1 to 5 of 5

Thread: How to redirect after login

  1. #1

    Default 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.

  2. #2

    Default

    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).

  3. #3

    Default

    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..

  4. #4

    Default

    paste here your xml, etc, so it will be easier to help.
    In addition, have a look here.

  5. #5
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    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.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •