Expresso 5-6

com.jcorporate.expresso.core.servlet
Class CheckLogin

java.lang.Object
  extended bycom.jcorporate.expresso.core.servlet.CheckLogin

public final class CheckLogin
extends Object

CheckLogin accepts an HttpServletRequest and HttpServletResponse object pair, and attempts to check if the user is logged in. If not, CheckLogin tries to log the user in via a cookie from the client. If this is not possible, the user is logged in as "NONE".

It has now been modified to be a Singleton Object rather than having a new object allocated with each request.

Example Usage:
CheckLogin.getInstance().checkLogin(request,response);

Author:
Michael Nash, Singleton Modification by Michael Rimov

Constructor Summary
protected CheckLogin()
          Default Constructor....
 
Method Summary
 void checkLogin(HttpServletRequest request)
          see if login is legitimate
 void checkLogin(HttpServletRequest request, HttpServletResponse response)
          Deprecated. use other checkLogin(request, forcedb); 9/04 v.5.5+
 void checkLogin(HttpServletRequest request, HttpServletResponse response, ServletConfig c)
          Deprecated. use other checkLogin(request, forcedb); 9/04 v.5.5+
 void checkLogin(HttpServletRequest request, HttpServletResponse response, ServletConfig c, String forceDB)
          Deprecated. use other checkLogin(request, forcedb); 9/04 v.5.5+
 void checkLogin(HttpServletRequest request, String forceDB)
          see if login is legitimate
static CheckLogin getInstance()
           
 void logInAsNone(HttpServletRequest request, String forceDB)
          For some reason a login session could not be established, so log the user in as the "unknown" user "NONE"
 boolean loginViaContainer(HttpServletRequest request, String forceDB)
          Try to log in with a user name obtained from the container.
 boolean loginViaCookie(HttpServletRequest request, String forceDB)
          Try to log in via the cookie from the client - if successful, return true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckLogin

protected CheckLogin()
Default Constructor.... Simply sets up the Log It should not be called anymore directly. Use getInstance() instead.

Method Detail

getInstance

public static CheckLogin getInstance()

checkLogin

public void checkLogin(HttpServletRequest request,
                       HttpServletResponse response,
                       ServletConfig c,
                       String forceDB)
                throws ServletException,
                       NonHandleableException
Deprecated. use other checkLogin(request, forcedb); 9/04 v.5.5+

see if login is legitimate

Parameters:
request - Standard request object
response - Standard response object
c - ServletConfig object of the calling servlet
forceDB - the db to force a login to
Throws:
ServletException - If an uncaught exception occurs
NonHandleableException - upon fatal error

checkLogin

public void checkLogin(HttpServletRequest request,
                       String forceDB)
                throws ServletException,
                       NonHandleableException
see if login is legitimate

Parameters:
request - Standard request object
forceDB - the db to force a login to
Throws:
ServletException - If an uncaught exception occurs
NonHandleableException - upon fatal error

checkLogin

public void checkLogin(HttpServletRequest request)
                throws ServletException,
                       NonHandleableException
see if login is legitimate

Parameters:
request - Standard request object
Throws:
ServletException - If an uncaught exception occurs
NonHandleableException - upon fatal error

checkLogin

public void checkLogin(HttpServletRequest request,
                       HttpServletResponse response,
                       ServletConfig c)
                throws ServletException,
                       NonHandleableException
Deprecated. use other checkLogin(request, forcedb); 9/04 v.5.5+

see if login is legitimate

Parameters:
request - Standard request object
response - Standard response object
c - ServletConfig object of the calling servlet
Throws:
ServletException - If an uncaught exception occurs
NonHandleableException - upon fatal error

checkLogin

public void checkLogin(HttpServletRequest request,
                       HttpServletResponse response)
                throws NonHandleableException
Deprecated. use other checkLogin(request, forcedb); 9/04 v.5.5+

see if login is legitimate

Parameters:
request - Standard request object
response - Standard response object
Throws:
NonHandleableException - upon fatal error

logInAsNone

public void logInAsNone(HttpServletRequest request,
                        String forceDB)
                 throws ServletException
For some reason a login session could not be established, so log the user in as the "unknown" user "NONE"

Parameters:
request - the servlet request object
forceDB - the data context to log into
Throws:
ServletException

loginViaContainer

public boolean loginViaContainer(HttpServletRequest request,
                                 String forceDB)
                          throws Exception
Try to log in with a user name obtained from the container. This function assumes that the container has already authenticated the user's ID and password, thus no password checking is performed.

This is intended to allow more fine-grained access control via Expresso's built-in mechanisms.

If successful, return true. If not, return false.

Parameters:
request - The request object
forceDB - Name of default database to set
Returns:
true if successfull
Throws:
Exception - upon error

loginViaCookie

public boolean loginViaCookie(HttpServletRequest request,
                              String forceDB)
                       throws Exception
Try to log in via the cookie from the client - if successful, return true. If not, return false

Parameters:
request - the servlet request object
forceDB - the data context to login to
Returns:
true if successfull
Throws:
Exception - upon error

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.