SigPath

org.sigpath.util
Class Authenticate

java.lang.Object
  extended by org.sigpath.util.Authenticate
All Implemented Interfaces:
Serializable

public class Authenticate
extends Object
implements Serializable

Utility Class for Authenticating Users. In order to be authenticated, three requirements must be met:

Author:
Ethan Cerami
See Also:
Serialized Form

Constructor Summary
Authenticate(Cookie[] cookies, XDebug xdebug)
          Constructor.
Authenticate(String username)
          Used in JUnit tests.
 
Method Summary
 Cookie createIDCookie(Login form)
          Creates User Identification Cookie.
 Cookie createInvalidatedCookie()
          Creates Invalidated User Identification Cookie.
 User getUser()
          Gets User Object from Current Session.
 String getUserName()
          Gets User Name from Current Session.
 boolean isAdmin()
          Is the user an Admin?
 boolean isAuthenticated()
          Is the user authenticated?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Authenticate

public Authenticate(Cookie[] cookies,
                    XDebug xdebug)
             throws SigPathDatabaseException,
                    UnsupportedEncodingException
Constructor.

Parameters:
cookies - Array of Cookie Object from HttpServletRequest
xdebug - Live Debugger Object
Throws:
SigPathDatabaseException - Indicates Database Error
UnsupportedEncodingException

Authenticate

public Authenticate(String username)
Used in JUnit tests. Do not use in the web app, this is for JUnit tests.

Parameters:
username - The name of the user that the test assumes has been authenticated.
Method Detail

createIDCookie

public Cookie createIDCookie(Login form)
                      throws SigPathDatabaseException
Creates User Identification Cookie.

Parameters:
form - Login Form
Returns:
Identification Cookie or null if invalid username/password
Throws:
SigPathDatabaseException - Indicates Database Error

createInvalidatedCookie

public Cookie createInvalidatedCookie()
Creates Invalidated User Identification Cookie.

Returns:
Identification Cookie

isAuthenticated

public boolean isAuthenticated()
Is the user authenticated?

Returns:
true if the user has been authenticated

isAdmin

public boolean isAdmin()
Is the user an Admin?

Returns:
true if the user is an admin

getUserName

public String getUserName()
Gets User Name from Current Session.

Returns:
User Name

getUser

public User getUser()
Gets User Object from Current Session.

Returns:
User Object

SigPath

Copyright © 2002-2005 Institute for Computational Biomedicine, All Rights Reserved.