org.web_auth.bizobj
Interface IUserSession

All Known Implementing Classes:
UserSession

public interface IUserSession

An interface to model any type of user sessions. A user session is created after a user successful logs in. The user session then stores the user object in the session. The user object can be retrieved at any time before the session is expired or the user logs out.

Version:
1.0
Author:
Zhengrong Tang

Method Summary
 boolean createSession(java.sql.Connection conn, java.lang.String username)
          Creates a user session.
 java.lang.String getId()
           
 IUser getUser(javax.servlet.http.HttpServletRequest request)
          Get the IUser object from the current session
 void invalidateSession(java.sql.Connection conn)
          Makes the user session invalid.
 boolean isLoggedIn(java.sql.Connection conn, javax.servlet.http.HttpServletRequest request)
          Checked whether a user has logged in or not.
 boolean isValidSession(java.sql.Connection conn)
          Check whether the session object is a valid session or not.
 void setId(java.lang.String val)
           
 void setUser(javax.servlet.http.HttpServletRequest request, IUser user)
          Set the IUser object to the current session.
 

Method Detail

getUser

public IUser getUser(javax.servlet.http.HttpServletRequest request)
Get the IUser object from the current session

Parameters:
request - The HttpSevletRequest object that links to the current session
Returns:
an IUser object.

setUser

public void setUser(javax.servlet.http.HttpServletRequest request,
                    IUser user)
Set the IUser object to the current session.

Parameters:
request - The HttpSevletRequest object that links to the current session
user - the IUser object to be set

isValidSession

public boolean isValidSession(java.sql.Connection conn)
Check whether the session object is a valid session or not.

Parameters:
conn - the database connection object for connecting to the database
Returns:
true if the session is valid, false otherwise

createSession

public boolean createSession(java.sql.Connection conn,
                             java.lang.String username)
Creates a user session.

Parameters:
conn - the database connection object for connecting to the database
username - the username associated to this session.
Returns:
true if the creation is successful; false otherwise

invalidateSession

public void invalidateSession(java.sql.Connection conn)
Makes the user session invalid.

Parameters:
conn - the database connection object for connecting to the database

isLoggedIn

public boolean isLoggedIn(java.sql.Connection conn,
                          javax.servlet.http.HttpServletRequest request)
Checked whether a user has logged in or not.

Parameters:
conn - the database connection object for connecting to the database
request - an HttpServletRequest
Returns:
true if a user is logged in; false otherwise

getId

public java.lang.String getId()

setId

public void setId(java.lang.String val)


Copyright © 2003 Zhengrong Tang. All Rights Reserved.