In my current Play 2 application, login sessions timeout after 5 minutes. When the user then clicks on any links in the app, they are redirected to the login page. After successful authentication, they are redirected to the main page.
I have implemented a system where the user is redirected to the page they were trying to reach before being redirected to the login page.
The system works like this: when the user with an expired session clicks an internal link, Deadbolt determines they are not logged in and redirects them to the login page. Before the redirect, it grabs the target url from the request header and stores it in the session. After the user fills out the login form on the following page, they submit the details to the authentication action. If the authentication is successful, the action checks to see if a target url exists in session; if so, it clears the item from the session and redirects to the target url, if not, it redirects to the main page.
The target url exists as a String for the duration and is fed into the play.mvc.Results.redirect( String url ) method as such.
I'm wondering if this opens up any potential attack vectors to my app?