org.apache.beehive.netui.pageflow.internal
Class DefaultLoginHandler

Object
  extended by DefaultHandler
      extended by DefaultLoginHandler
All Implemented Interfaces:
Serializable, Handler, LoginHandler

public class DefaultLoginHandler
extends DefaultHandler
implements LoginHandler, Serializable

Implements default J2EE web-tier login handling.

See Also:
Serialized Form

Constructor Summary
DefaultLoginHandler()
           
 
Method Summary
 Principal getUserPrincipal(HttpServletRequest request)
          Get the current user.
 void init(ServletContext servletContext)
          Initialize.
 boolean isUserInRole(String roleName, HttpServletRequest request)
          Tell whether the current user is in a given role.
 void login(String username, String password, HttpServletRequest request, HttpServletResponse response)
          Log in the given user.
 void logout(boolean invalidateSessions, HttpServletRequest request, HttpServletResponse response)
          Log out the current user.
 
Methods inherited from class DefaultHandler
getServletContext, reinit
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Handler
reinit
 

Constructor Detail

DefaultLoginHandler

public DefaultLoginHandler()
Method Detail

init

public void init(ServletContext servletContext)
Description copied from class: DefaultHandler
Initialize.

Specified by:
init in interface Handler
Overrides:
init in class DefaultHandler
Parameters:
servletContext - the ServletContext for the webapp that is creating this object.

login

public void login(String username,
                  String password,
                  HttpServletRequest request,
                  HttpServletResponse response)
           throws LoginException
Description copied from interface: LoginHandler
Log in the given user.

Specified by:
login in interface LoginHandler
Parameters:
username - the user to log in.
password - the user's password.
request - the current HttpServletRequest.
Throws:
LoginException - if the login fails.

logout

public void logout(boolean invalidateSessions,
                   HttpServletRequest request,
                   HttpServletResponse response)
Description copied from interface: LoginHandler
Log out the current user.

Specified by:
logout in interface LoginHandler
Parameters:
invalidateSessions - if true, current sessions associated with the current logged-in user will be invalidated.
request - the current HttpServletRequest.

isUserInRole

public boolean isUserInRole(String roleName,
                            HttpServletRequest request)
Description copied from interface: LoginHandler
Tell whether the current user is in a given role.

Specified by:
isUserInRole in interface LoginHandler
Parameters:
roleName - the role to check.
request - the current HttpServletRequest.
Returns:
true if the current logged-in user is in the given role.

getUserPrincipal

public Principal getUserPrincipal(HttpServletRequest request)
Description copied from interface: LoginHandler
Get the current user.

Specified by:
getUserPrincipal in interface LoginHandler
Parameters:
request - the current HttpServletRequest.
Returns:
a Principal that represents the current logged-in user.