com.arsdigita.toolbox.ui
Class ApplicationAuthenticationListener

java.lang.Object
  extended bycom.arsdigita.toolbox.ui.ApplicationAuthenticationListener
All Implemented Interfaces:
EventListener, RequestListener

public class ApplicationAuthenticationListener
extends Object
implements RequestListener

A request listener that checks a privilege against the current resource as accessed from Kernel.getContext().getResource() For example, to restrict a page to admin users only:

  Page page = PageFactory.buildPage("myapp", "My Admin Page");
  page.addRequestListener(new ApplicationAuthenticationListener());
  page.lock();
 


Field Summary
 
Fields inherited from interface com.arsdigita.bebop.event.RequestListener
versionId
 
Constructor Summary
ApplicationAuthenticationListener()
          Creates a listener that checks for ADMIN privilege
ApplicationAuthenticationListener(PrivilegeDescriptor privilege)
          Creates a listener that checks for an arbitrary privilege
 
Method Summary
 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
 

Constructor Detail

ApplicationAuthenticationListener

public ApplicationAuthenticationListener()
Creates a listener that checks for ADMIN privilege


ApplicationAuthenticationListener

public ApplicationAuthenticationListener(PrivilegeDescriptor privilege)
Creates a listener that checks for an arbitrary privilege

Parameters:
privilege - the privilege to check for
Method Detail

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 21 2004:2337 UTC