Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acegisecurity.vote
Class AbstractAclVoter  view AbstractAclVoter download AbstractAclVoter.java

java.lang.Object
  extended byorg.acegisecurity.vote.AbstractAclVoter
All Implemented Interfaces:
AccessDecisionVoter
Direct Known Subclasses:
BasicAclEntryVoter

public abstract class AbstractAclVoter
extends java.lang.Object
implements AccessDecisionVoter

Given a domain object instance passed as a method argument, ensures the principal has appropriate permission as defined by the org.acegisecurity.acl.AclManager.

The AclManager is used to retrieve the access control list (ACL) permissions associated with a domain object instance for the current Authentication object. This class is designed to process org.acegisecurity.acl.AclEntrys that are subclasses of org.acegisecurity.acl.basic.BasicAclEntry only. Generally these are obtained by using the org.acegisecurity.acl.basic.BasicAclProvider.

The voter will vote if any ConfigAttribute#getAttribute() matches the #processConfigAttribute. The provider will then locate the first method argument of type processDomainObjectClass 55 . Assuming that method argument is non-null, the provider will then lookup the ACLs from the AclManager and ensure the principal is BasicAclEntry.isPermitted(int)>BasicAclEntry.isPermitted(int) 55 for at least one of the #requirePermissions.

If the method argument is null, the voter will abstain from voting. If the method argument could not be found, an org.acegisecurity.AuthorizationServiceException will be thrown.

In practical terms users will typically setup a number of BasicAclEntryVoters. Each will have a different processDomainObjectClass 55 , #processConfigAttribute and #requirePermission combination. For example, a small application might employ the following instances of BasicAclEntryVoter:

Alternatively, you could have used a common superclass or interface for the processDomainObjectClass 55 if both BankAccount and Customer had common parents.

If the principal does not have sufficient permissions, the voter will vote to deny access.

The AclManager is allowed to return any implementations of AclEntry it wishes. However, this provider will only be able to validate against AbstractBasicAclEntrys, and thus a vote to deny access will be made if no AclEntry is of type AbstractBasicAclEntry.

All comparisons and prefixes are case sensitive.

Version:
$Id: AbstractAclVoter.java,v 1.2 2005/11/17 00:55:47 benalex Exp $

Field Summary
private  java.lang.Class processDomainObjectClass
           
 
Fields inherited from interface org.acegisecurity.vote.AccessDecisionVoter
ACCESS_ABSTAIN, ACCESS_DENIED, ACCESS_GRANTED
 
Constructor Summary
AbstractAclVoter()
           
 
Method Summary
protected  java.lang.Object getDomainObjectInstance(java.lang.Object secureObject)
           
 java.lang.Class getProcessDomainObjectClass()
           
 void setProcessDomainObjectClass(java.lang.Class processDomainObjectClass)
           
 boolean supports(java.lang.Class clazz)
          This implementation supports only MethodSecurityInterceptor, because it queries the presented MethodInvocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.acegisecurity.vote.AccessDecisionVoter
supports, vote
 

Field Detail

processDomainObjectClass

private java.lang.Class processDomainObjectClass
Constructor Detail

AbstractAclVoter

public AbstractAclVoter()
Method Detail

setProcessDomainObjectClass

public void setProcessDomainObjectClass(java.lang.Class processDomainObjectClass)

getProcessDomainObjectClass

public java.lang.Class getProcessDomainObjectClass()

supports

public boolean supports(java.lang.Class clazz)
This implementation supports only MethodSecurityInterceptor, because it queries the presented MethodInvocation.


getDomainObjectInstance

protected java.lang.Object getDomainObjectInstance(java.lang.Object secureObject)