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, org.apache.lenya.ac.AccessController, org.apache.lenya.ac.ItemManagerListener
Direct Known Subclasses:
BypassableAccessController

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

Default access controller implementation.

Version:
$Id: DefaultAccessController.java 563459 2007-08-07 12:00:20Z nettings $

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)
           
 boolean authorize(org.apache.cocoon.environment.Request request)
           
 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()
           
 org.apache.lenya.ac.AccreditableManager getAccreditableManager()
          Returns the accreditable manager.
 org.apache.lenya.ac.Authenticator getAuthenticator()
          Returns the authenticator.
 org.apache.lenya.ac.Authorizer[] getAuthorizers()
          Returns the authorizers of this action.
protected  org.apache.avalon.framework.service.ServiceManager getManager()
          Returns the service manager.
 org.apache.lenya.ac.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(org.apache.lenya.ac.Item item)
           
 void itemRemoved(org.apache.lenya.ac.Item item)
           
 boolean ownsIdenity(org.apache.lenya.ac.Identity identity)
          Checks if this identity was initialized by this access controller.
protected  void resolveRoles(org.apache.cocoon.environment.Request request)
           
protected  void saveRoles(org.apache.cocoon.environment.Request request, org.apache.lenya.ac.Role[] roles)
          Saves the roles of the current identity to the request.
 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)
           
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 org.apache.lenya.ac.AccessControlException
Specified by:
authenticate in interface org.apache.lenya.ac.AccessController
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
AccessController.authenticate(org.apache.cocoon.environment.Request)

authorize

public boolean authorize(org.apache.cocoon.environment.Request request)
                  throws org.apache.lenya.ac.AccessControlException
Specified by:
authorize in interface org.apache.lenya.ac.AccessController
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
AccessController.authorize(org.apache.cocoon.environment.Request)

resolveRoles

protected void resolveRoles(org.apache.cocoon.environment.Request request)
                     throws org.apache.lenya.ac.AccessControlException
Throws:
org.apache.lenya.ac.AccessControlException

saveRoles

protected void saveRoles(org.apache.cocoon.environment.Request request,
                         org.apache.lenya.ac.Role[] roles)
Saves the roles of the current identity to the request.

Parameters:
request - The request.
roles - The roles.

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.

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)

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 org.apache.lenya.ac.Authorizer[] getAuthorizers()
Returns the authorizers of this action.

Specified by:
getAuthorizers in interface org.apache.lenya.ac.AccessController
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 org.apache.lenya.ac.AccreditableManager getAccreditableManager()
Returns the accreditable manager.

Specified by:
getAccreditableManager in interface org.apache.lenya.ac.AccessController
Returns:
An accreditable manager.

getPolicyManager

public org.apache.lenya.ac.PolicyManager getPolicyManager()
Returns the policy manager.

Specified by:
getPolicyManager in interface org.apache.lenya.ac.AccessController
Returns:
A policy manager.

getAuthenticator

public org.apache.lenya.ac.Authenticator getAuthenticator()
Returns the authenticator.

Returns:
The authenticator.

ownsIdenity

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

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

setupIdentity

public void setupIdentity(org.apache.cocoon.environment.Request request)
                   throws org.apache.lenya.ac.AccessControlException
Specified by:
setupIdentity in interface org.apache.lenya.ac.AccessController
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
AccessController.setupIdentity(org.apache.cocoon.environment.Request)

hasValidIdentity

protected boolean hasValidIdentity(org.apache.cocoon.environment.Session session)
                            throws org.apache.lenya.ac.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:
org.apache.lenya.ac.AccessControlException - when something went wrong.

itemAdded

public void itemAdded(org.apache.lenya.ac.Item item)
               throws org.apache.lenya.ac.AccessControlException
Specified by:
itemAdded in interface org.apache.lenya.ac.ItemManagerListener
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
ItemManagerListener.itemAdded(org.apache.lenya.ac.Item)

itemRemoved

public void itemRemoved(org.apache.lenya.ac.Item item)
                 throws org.apache.lenya.ac.AccessControlException
Specified by:
itemRemoved in interface org.apache.lenya.ac.ItemManagerListener
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
ItemManagerListener.itemRemoved(org.apache.lenya.ac.Item)


Copyright $ Apache Software Foundation. All Rights Reserved.