org.apache.lenya.ac.impl
Class PolicyAuthorizer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.ac.impl.PolicyAuthorizer
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.logger.LogEnabled, Authorizer

public class PolicyAuthorizer
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements Authorizer

Policy-based authorizer.

Version:
$Id: PolicyAuthorizer.java 473841 2006-11-12 00:46:38Z gregor $

Field Summary
 
Fields inherited from interface org.apache.lenya.ac.Authorizer
ROLE
 
Constructor Summary
PolicyAuthorizer()
          Creates a new policy authorizer.
 
Method Summary
 boolean authorize(org.apache.cocoon.environment.Request request)
          Authorizes an identity at a URL.
protected  boolean authorizePolicy(Identity identity, org.apache.cocoon.environment.Request request)
          Authorizes an request for an identity depending on a policy.
 AccreditableManager getAccreditableManager()
          Returns the accreditable manager.
 PolicyManager getPolicyManager()
          Returns the policy manager.
static Role[] getRoles(org.apache.cocoon.environment.Request request)
          Fetches the stored roles from the request.
protected  void saveRoles(org.apache.cocoon.environment.Request request, Role[] roles)
          Saves the roles of the current identity to the request.
 void setAccreditableManager(AccreditableManager manager)
          Sets the accreditable manager.
 void setPolicyManager(PolicyManager manager)
          Sets 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
 

Constructor Detail

PolicyAuthorizer

public PolicyAuthorizer()
Creates a new policy authorizer.

Method Detail

getAccreditableManager

public AccreditableManager getAccreditableManager()
Returns the accreditable manager.

Returns:
An accreditable manager.

getPolicyManager

public PolicyManager getPolicyManager()
Returns the policy manager.

Returns:
A policy manager.

setPolicyManager

public void setPolicyManager(PolicyManager manager)
Sets the policy manager.

Parameters:
manager - A policy manager.

setAccreditableManager

public void setAccreditableManager(AccreditableManager manager)
Sets the accreditable manager.

Parameters:
manager - An accreditable manager.

authorize

public boolean authorize(org.apache.cocoon.environment.Request request)
                  throws AccessControlException
Description copied from interface: Authorizer
Authorizes an identity at a URL.

Specified by:
authorize in interface Authorizer
Parameters:
request - The request.
Returns:
true if the identity is authorized, false otherwise.
Throws:
AccessControlException - when something went wrong.
See Also:
Authorizer.authorize(org.apache.cocoon.environment.Request)

authorizePolicy

protected boolean authorizePolicy(Identity identity,
                                  org.apache.cocoon.environment.Request request)
                           throws AccessControlException
Authorizes an request for an identity depending on a policy.

Parameters:
identity - The identity to authorize.
request - The request to authorize.
Returns:
A boolean value.
Throws:
AccessControlException - when something went wrong.

saveRoles

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

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

getRoles

public static Role[] getRoles(org.apache.cocoon.environment.Request request)
                       throws AccessControlException
Fetches the stored roles from the request.

Parameters:
request - The request.
Returns:
A role array.
Throws:
AccessControlException - If the request does not contain the roles list.


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