org.apache.lenya.ac.impl
Class DefaultAccessController

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.ac.impl.DefaultAccessController
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, AccessController, ItemManagerListener
Direct Known Subclasses:
BypassableAccessController

public class DefaultAccessController
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements AccessController, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable, ItemManagerListener

Default access controller implementation.

Version:
$Id: DefaultAccessController.java 473842 2006-11-12 01:15:20Z gregor $

Field Summary
protected static java.lang.String ACCREDITABLE_MANAGER_ELEMENT
           
protected static java.lang.String AUTHORIZER_ELEMENT
           
protected static java.lang.String POLICY_MANAGER_ELEMENT
           
protected static java.lang.String TYPE_ATTRIBUTE
           
 
Fields inherited from interface org.apache.lenya.ac.AccessController
DEFAULT_PREFIX, NAMESPACE, ROLE
 
Constructor Summary
DefaultAccessController()
           
 
Method Summary
 boolean authenticate(org.apache.cocoon.environment.Request request)
          Authenticates a request.
 boolean authorize(org.apache.cocoon.environment.Request request)
          Authorizes a request inside a publication.
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
           
static void configureOrParameterize(org.apache.avalon.framework.component.Component component, org.apache.avalon.framework.configuration.Configuration configuration)
          Configures or parameterizes a component, depending on the implementation as Configurable or Parameterizable.
 void dispose()
           
 AccreditableManager getAccreditableManager()
          Returns the accreditable manager.
 Authenticator getAuthenticator()
          Returns the authenticator.
 Authorizer[] getAuthorizers()
          Returns the authorizers of this action.
protected  org.apache.avalon.framework.service.ServiceManager getManager()
          Returns the service manager.
 PolicyManager getPolicyManager()
          Returns the policy manager.
protected  boolean hasAuthorizers()
          Returns if this action has authorizers.
protected  boolean hasValidIdentity(org.apache.cocoon.environment.Session session)
          Checks if the session contains an identity that is not null and belongs to the used access controller.
 void itemAdded(Item item)
          Called when an accreditable was added.
 void itemRemoved(Item item)
          Called when an accreditable was removed.
 boolean ownsIdenity(Identity identity)
          Checks if this identity was initialized by this access controller.
 void service(org.apache.avalon.framework.service.ServiceManager manager)
          Set the global component manager.
protected  void setupAccreditableManager(org.apache.avalon.framework.configuration.Configuration configuration)
          Creates the accreditable manager.
protected  void setupAuthenticator()
          Sets up the authenticator.
protected  void setupAuthorizers(org.apache.avalon.framework.configuration.Configuration configuration)
          Creates the authorizers.
 void setupIdentity(org.apache.cocoon.environment.Request request)
          Initializes the identity for this access controller.
protected  void setupPolicyManager(org.apache.avalon.framework.configuration.Configuration configuration)
          Creates the policy manager.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHORIZER_ELEMENT

protected static final java.lang.String AUTHORIZER_ELEMENT
See Also:
Constant Field Values

TYPE_ATTRIBUTE

protected static final java.lang.String TYPE_ATTRIBUTE
See Also:
Constant Field Values

ACCREDITABLE_MANAGER_ELEMENT

protected static final java.lang.String ACCREDITABLE_MANAGER_ELEMENT
See Also:
Constant Field Values

POLICY_MANAGER_ELEMENT

protected static final java.lang.String POLICY_MANAGER_ELEMENT
See Also:
Constant Field Values
Constructor Detail

DefaultAccessController

public DefaultAccessController()
Method Detail

authenticate

public boolean authenticate(org.apache.cocoon.environment.Request request)
                     throws AccessControlException
Description copied from interface: AccessController
Authenticates a request.

Specified by:
authenticate in interface AccessController
Parameters:
request - A request.
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.
See Also:
AccessController.authenticate(org.apache.cocoon.environment.Request)

authorize

public boolean authorize(org.apache.cocoon.environment.Request request)
                  throws AccessControlException
Description copied from interface: AccessController
Authorizes a request inside a publication.

Specified by:
authorize in interface AccessController
Parameters:
request - A request.
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.
See Also:
AccessController.authorize(org.apache.cocoon.environment.Request)

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

configureOrParameterize

public static void configureOrParameterize(org.apache.avalon.framework.component.Component component,
                                           org.apache.avalon.framework.configuration.Configuration configuration)
                                    throws org.apache.avalon.framework.configuration.ConfigurationException,
                                           org.apache.avalon.framework.parameters.ParameterException
Configures or parameterizes a component, depending on the implementation as Configurable or Parameterizable.

Parameters:
component - The component.
configuration - The configuration to use.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - when an error occurs during configuration.
org.apache.avalon.framework.parameters.ParameterException - when an error occurs during parameterization.

setupAccreditableManager

protected void setupAccreditableManager(org.apache.avalon.framework.configuration.Configuration configuration)
                                 throws org.apache.avalon.framework.configuration.ConfigurationException,
                                        org.apache.avalon.framework.service.ServiceException,
                                        org.apache.avalon.framework.parameters.ParameterException
Creates the accreditable manager.

Parameters:
configuration - The access controller configuration.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - when the configuration failed.
org.apache.avalon.framework.service.ServiceException - when something went wrong.
org.apache.avalon.framework.parameters.ParameterException - when something went wrong.

setupAuthorizers

protected void setupAuthorizers(org.apache.avalon.framework.configuration.Configuration configuration)
                         throws org.apache.avalon.framework.service.ServiceException,
                                org.apache.avalon.framework.configuration.ConfigurationException,
                                org.apache.avalon.framework.parameters.ParameterException
Creates the authorizers.

Parameters:
configuration - The access controller configuration.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - when the configuration failed.
org.apache.avalon.framework.service.ServiceException - when something went wrong.
org.apache.avalon.framework.parameters.ParameterException - when something went wrong.

setupPolicyManager

protected void setupPolicyManager(org.apache.avalon.framework.configuration.Configuration configuration)
                           throws org.apache.avalon.framework.service.ServiceException,
                                  org.apache.avalon.framework.configuration.ConfigurationException,
                                  org.apache.avalon.framework.parameters.ParameterException
Creates the policy manager.

Parameters:
configuration - The access controller configuration.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - when the configuration failed.
org.apache.avalon.framework.service.ServiceException - when something went wrong.
org.apache.avalon.framework.parameters.ParameterException - when something went wrong.

setupAuthenticator

protected void setupAuthenticator()
                           throws org.apache.avalon.framework.service.ServiceException
Sets up the authenticator.

Throws:
org.apache.avalon.framework.service.ServiceException - when something went wrong.

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Set the global component manager.

Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Parameters:
manager - The global component manager
Throws:
org.apache.avalon.framework.service.ServiceException - when something went wrong.

getManager

protected org.apache.avalon.framework.service.ServiceManager getManager()
Returns the service manager.

Returns:
A service manager.

getAuthorizers

public Authorizer[] getAuthorizers()
Returns the authorizers of this action.

Returns:
An array of authorizers.

hasAuthorizers

protected boolean hasAuthorizers()
Returns if this action has authorizers.

Returns:
A boolean value.

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

getAccreditableManager

public AccreditableManager getAccreditableManager()
Returns the accreditable manager.

Returns:
An accreditable manager.

getPolicyManager

public PolicyManager getPolicyManager()
Returns the policy manager.

Returns:
A policy manager.

getAuthenticator

public Authenticator getAuthenticator()
Returns the authenticator.

Returns:
The authenticator.

ownsIdenity

public boolean ownsIdenity(Identity identity)
                    throws AccessControlException
Checks if this identity was initialized by this access controller.

Parameters:
identity - An identity.
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.

setupIdentity

public void setupIdentity(org.apache.cocoon.environment.Request request)
                   throws AccessControlException
Description copied from interface: AccessController
Initializes the identity for this access controller.

Specified by:
setupIdentity in interface AccessController
Parameters:
request - The request that contains the identity information.
Throws:
AccessControlException - when something went wrong.
See Also:
AccessController.setupIdentity(org.apache.cocoon.environment.Request)

hasValidIdentity

protected boolean hasValidIdentity(org.apache.cocoon.environment.Session session)
                            throws AccessControlException
Checks if the session contains an identity that is not null and belongs to the used access controller.

Parameters:
session - The current session.
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.

itemAdded

public void itemAdded(Item item)
               throws AccessControlException
Description copied from interface: ItemManagerListener
Called when an accreditable was added.

Specified by:
itemAdded in interface ItemManagerListener
Parameters:
item - The item that was added.
Throws:
AccessControlException - when an error occurs.
See Also:
ItemManagerListener.itemAdded(org.apache.lenya.ac.Item)

itemRemoved

public void itemRemoved(Item item)
                 throws AccessControlException
Description copied from interface: ItemManagerListener
Called when an accreditable was removed.

Specified by:
itemRemoved in interface ItemManagerListener
Parameters:
item - The item that was removed.
Throws:
AccessControlException - when an error occurs.
See Also:
ItemManagerListener.itemRemoved(org.apache.lenya.ac.Item)


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.