com.arsdigita.ui.login
Class UserAuthenticationListener

java.lang.Object
  extended bycom.arsdigita.ui.login.UserAuthenticationListener
All Implemented Interfaces:
EventListener, RequestListener

public class UserAuthenticationListener
extends Object
implements RequestListener

A RequestListener that redirects the user to register if not logged in. The redirection URL includes a return_url parameter to send the user back to this page after logging in. Pages must not continue processing if this listener redirects the user, since the response has already been committed (isLoggedIn() returns false in this case). In a future version, this listener will abort processing of the request if the user is not logged in.

Version:
1.0
Author:
Phong Nguyen, Sameer Ajmani

Field Summary
static String versionId
           
 
Constructor Summary
UserAuthenticationListener()
           
 
Method Summary
 User getUser(PageState state)
          If the user is logged in, returns the User object.
 boolean isLoggedIn(PageState state)
          Determines whether the user is logged in.
 void pageRequested(RequestEvent event)
          Checks whether the user is logged in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

UserAuthenticationListener

public UserAuthenticationListener()
Method Detail

getUser

public User getUser(PageState state)
If the user is logged in, returns the User object.

Returns:
the User object for the logged in user
Throws:
IllegalStateException - if user is not logged in. Call isLoggedIn() to check for this case.

isLoggedIn

public boolean isLoggedIn(PageState state)
Determines whether the user is logged in.

Returns:
true if the user is logged in

pageRequested

public void pageRequested(RequestEvent event)
Checks whether the user is logged in. If not, redirects the client to the login page.

Specified by:
pageRequested in interface RequestListener


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC