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

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

public class DefaultLoginHandler
extends DefaultHandler
implements LoginHandler

Implements default J2EE web-tier login handling.

See Also:
Serialized Form

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

Constructor Detail

DefaultLoginHandler

public DefaultLoginHandler(ServletContext servletContext)
Method Detail

login

public void login(FlowControllerHandlerContext context,
                  String username,
                  String password)
           throws LoginException
Description copied from interface: LoginHandler
Log in the given user.

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

logout

public void logout(FlowControllerHandlerContext context,
                   boolean invalidateSessions)
Description copied from interface: LoginHandler
Log out the current user.

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

isUserInRole

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

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

getUserPrincipal

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

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