webtier@glassfish.java.net

Re: Login using realm security

From: <webtier_at_javadesktop.org>
Date: Thu, 08 Jan 2009 22:36:00 PST

If your objective is to redirect the user to the login page before accessing a secure page (like pageU.jsp), making use of the Glassfish realms, you could use form based authentication after making the pageU.jsp secure:

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/LoginA.jsp</form-login-page>
<form-error-page>/loginError.html</form-error-page>
</form-login-config>
</login-config>

You would be required to have the following in LoginA.jsp:

<form method="POST" action="[b]j_security_check[/b]">
<input type="text" name="[b]j_username[/b]">
<input type="password" name="[b]j_password[/b]">
</form>

If the page-to-be-redirected after successful authentication (say pageU.jsp) is made a welcome file and a secured, accessing the application, redirects the user to LoginA.jsp, and if successful, redirects user to pageU.jsp, and if not, to loginError.html.

Would this help your use-case?

Nithya
[Message sent by forum member 'nitkal' (nitkal)]

http://forums.java.net/jive/thread.jspa?messageID=324931