com.raritantechnologies.searchApp.taglibrary
Class LoginForm

java.lang.Object
  extended byBodyTagSupport
      extended bycom.raritantechnologies.searchApp.taglibrary.LoginForm
All Implemented Interfaces:
IConfigurable, ICustomTag

public class LoginForm
extends BodyTagSupport
implements ICustomTag

Generic login form. Plugs into a graphical form through a submit function and a javascript username and password variable paths.

THe login form: is designed to be used with these HTTP initialization parameters. The login page is typically invoked by a page that checks if the user has logged in appropriately.

   forwardPage     = page to forward to if login is successful;
   securityManager = security manager to use for login (optional);
   successAttrib   = session attribute name to set for successful login.
   checkAccess     = true if access to content is requested
   noAccessPage    = page to open if access is denied.
   accessName      = optional login access name (auxillary login name)
 

Example CheckLogin.jsp - Checks for standard login:

  The CheckLogin.jsp page is invoked from a content page using this code:
  <%@ include file="CheckLogin.jsp" %>

  CheckLogin.jsp:
  <%
    String sessionID = request.getSession( ).getId( );
    com.raritantechnologies.quickstart.SessionManager sessMan = com.raritantechnologies.quickstart.SessionManager.getInstance( );
    java.util.Map sessionData = sessMan.getSessionData( sessionID );
    com.raritantechnologies.searchApp.ILoginInfo loginInfo = null;
    com.raritantechnologies.quickstart.UserSession userSess = sessMan.getSession( sessionID );
 
    if ( userSess != null )
    {
      loginInfo = userSess.getUserLogin( );
     }

    if ( loginInfo == null || ( !loginInfo.getSessionId( ).equals( sessionID ) ) )
    {
  %>
      <jsp:forward page = 'login.jsp'>
      <jsp:param name = 'successAttrib' value = 'LoggedIn' />
      <jsp:param name = 'href' value = '<%=href %>' />
      </jsp:forward>
  <%
    }
  %>

 
Example: This JSP tag:
 <search:LoginForm
   submitFunction="doIt( )"
   usernameVariable="document.uForm.uTemp.value"
   passwordVariable="document.pForm.pTemp.value"
   errorPage="authform.jsp"
   checkAccess="[true|false(default)]"
   accessName="[ optional access login name - if different from main login... ]"
 />

  Generates this javascript function and login form:
 <form name="Login" action="doLogin" method="post" >
 <input type="hidden" name="UserName" >
 <input type="hidden" name="Password" >

 <input type="hidden" name="securityManager" value="[securityManager param value]" />
 <input type="hidden" name="href"            value="[ forwardPage param value]" />
 <input type="hidden" name="errorPage"       value="/authform.jsp" />
 <input type="hidden" name="successAttrib"   value="[ successAttrib param value]" />
 <input type="hidden" name="accessName"      value="[ accessName param value]" />
 </form>
 <script language="javascript">
 function doIt( )
 {
   document.Login.UserName.value = document.uForm.uTemp.value;
   document.Login.Password.value = document.pForm.pTemp.value;
   document.Login.submit();
   return false;   
 }
 </script>
 

Developed by Raritan Technologies .

Author:
Ted Sullivan
See Also:
Serialized Form

Constructor Summary
LoginForm()
           
 
Method Summary
 int doAfterBody()
           
 int doStartTag()
           
 java.lang.String getBody(RaritanPageContext rpc)
          Returns the tag body.
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void initialize(java.util.Map initParams)
           
 void setAccessName(java.lang.String accessName)
           
 void setErrorPage(java.lang.String errorPage)
           
 void setForwardOverride(java.lang.String forwardOverride)
           
 void setForwardPage(java.lang.String forwardPage)
           
 void setLoginPath(java.lang.String loginPath)
           
 void setPasswordVariable(java.lang.String passwordVariable)
           
 void setSecurityManager(java.lang.String defaultSecurityManager)
           
 void setSubmitFunction(java.lang.String submitFunction)
           
 void setUsernameVariable(java.lang.String usernameVariable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoginForm

public LoginForm()
Method Detail

setSubmitFunction

public void setSubmitFunction(java.lang.String submitFunction)

setUsernameVariable

public void setUsernameVariable(java.lang.String usernameVariable)

setPasswordVariable

public void setPasswordVariable(java.lang.String passwordVariable)

setErrorPage

public void setErrorPage(java.lang.String errorPage)

setLoginPath

public void setLoginPath(java.lang.String loginPath)

setForwardPage

public void setForwardPage(java.lang.String forwardPage)

setForwardOverride

public void setForwardOverride(java.lang.String forwardOverride)

setAccessName

public void setAccessName(java.lang.String accessName)

setSecurityManager

public void setSecurityManager(java.lang.String defaultSecurityManager)

doStartTag

public int doStartTag()
               throws JspException
Throws:
JspException

getBody

public java.lang.String getBody(RaritanPageContext rpc)
Description copied from interface: ICustomTag
Returns the tag body.

Specified by:
getBody in interface ICustomTag
Parameters:
rpc - Platform-neutral page context ( can be used in non J2EE environments such as ASP).
Returns:
The tag body text string.

doAfterBody

public int doAfterBody()
                throws JspException
Throws:
JspException

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

initialize

public void initialize(java.util.Map initParams)
Specified by:
initialize in interface ICustomTag