webtier@glassfish.java.net

Re: [webtier] redirect the user once logged in to the requested page

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Fri, 5 Mar 2010 14:28:13 -0500

This is a Spring Security related question, not a JSF / GlassFish question
;) but it's still a good question. You can read this article for your
solution:

http://ocpsoft.com/java/jsf-java/spring-security-what-happens-after-you-log-in/

--Lincoln

On Thu, Mar 4, 2010 at 11:29 PM, <webtier_at_javadesktop.org> wrote:

> Hi
> I have a form realm authentication
> with which i am securing a directory "secureUser"
>
> well my question is: -
> How i can redirect the user once logged in to the requested page
>
> the details: -
>
> now i can log on a user using this (login.jsp)
>
> ==============================================================
>
> <form action="j_security_check" method="POST"
> id="login_from">
> <p>
> <input type="text" name="j_username"
> id="j_username" title="EmailID" />
> </p>
> <p>
> <input type="password" name="j_password"
> id="j_password" title="Password" />
> </p>
> <p>
> <input type="submit" name="Submit" id="Login"
> value="Login" />
> </p>
> </form>
>
> ==============================================================
>
> Now a user requests two or more pages in the same session browser
> (firefox/ie tabs)
> "secureUser/one.jsp"
> "secureUser/two.jsp"
> "secureUser/three.jsp"
>
> Now the user gets a login form page thats login.jsp for all the three
> requested pages
>
> The user authenticates into the page requested "secureUser/one.jsp"
>
> Now if the user reloads the page "secureUser/two.jsp" or
> "secureUser/three.jsp" which is now showing login.jsp
> he gets the same login.jsp page
>
> How i can redirect the user after logging in once to the requested page
> such that the page login.jsp after reloading goes to referred page
>
> I can do this in the login.jsp page
>
> ==============================================================
> java.security.Principal obj = request.getUserPrincipal();
>
> if(obj!=null)
> {
> response.sendRedirect("secureUser/one.jsp");
> }
>
> ==============================================================
>
> but i cannot get the referred page such as two.jsp or three.jsp
>
> Thanks
> Pradyut
> [Message sent by forum member 'pradyut' (pradyut100_at_yahoo.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=390185
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"