This tag is designed to simplify the logging in of a user. This tag extracts user and password values from the request object, validates against a security provider (LISA by default) and if the details are valid, sets up a Jeenius session cookie The Jeenius Session Cookie The Jeenius framework advocates the use of multiple web applications. This allows applications to easily developed and added to a Jeenius based system. However the JSP framework enforces that each web application has a unique context that it runs under. Each web application in effect has it’s own Application object and a collection of Session objects unique to the web application.This means that a login mechanism that stores login data into a Session for later extraction will not work. What is needed is a mechanism that allows a single login to be passed between web applications.
This is where the Jeenius Session Cookie comes into play. The basic logic is as follows:
1) During a successful login the security provider generates a token.
2) This token is passed to the user’s browser as a per-session cookie3) When a JSP page needs to perform a security check it extracts the token from this cookie and passes it to the security provider to validate. If the token is valid execution of the page can continue. The login tag implements steps 1 and 2 above Tag usage This tag has the following usage:
<jee:login defaultUrl=”url to redirect to” result=”script var. name for error bean”/>·
defaultUrl – This is the URL to which the user is redirected on a successful login. result – This is the name scripting variable to which the login error bean is bound. See Constants & JavaBeans section.This tag also expects that two parameters userId and password be set in the request object. After a successful login the tag redirects to the URL specified by defaultUrl. Optionally a url parameter can be set in the request object, in which case the tag redirects to the URL specified by this parameter. This tag also generates a Jeenius session cookie and binds the user ID (see Constants & JavaBeans section) into the Session object for this user for the web application that executes the tag.
The following code shows an example of using this tag:
<%@ taglib uri="jeenius" prefix="jee" %> <jee:login redirectUrl="main_app_page.jsp" result=”error”/> <html> <head> <title>Login Page</title> </head> <body> <p>This is the login page enter your user ID and password.</p> <p><jsp:getProperty name=”error” property=”message”/></p> <p> <form method="POST"> User ID: <input type="text" name="userId" size="20"><br> Password: <input type="password" name="password" size="20"><br> <input type="submit" name="btnLogin" value="Login"> </form> </body> </html>