Spring Security Framework

org.springframework.security.vote
Class BasicAclEntryVoter

java.lang.Object
  extended by org.springframework.security.vote.AbstractAclVoter
      extended by org.springframework.security.vote.BasicAclEntryVoter
All Implemented Interfaces:
InitializingBean, AccessDecisionVoter

Deprecated. Use new spring-security-acl module instead

public class BasicAclEntryVoter
extends AbstractAclVoter
implements InitializingBean

Given a domain object instance passed as a method argument, ensures the principal has appropriate permission as defined by the 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 AclEntrys that are subclasses of BasicAclEntry only. Generally these are obtained by using the BasicAclProvider.

The voter will vote if any ConfigAttribute.getAttribute() matches the processConfigAttribute. The provider will then locate the first method argument of type AbstractAclVoter.processDomainObjectClass. 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) 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 AuthorizationServiceException will be thrown.

In practical terms users will typically setup a number of BasicAclEntryVoters. Each will have a different AbstractAclVoter.processDomainObjectClass, 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 AbstractAclVoter.processDomainObjectClass 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$
Author:
Ben Alex

Field Summary
 
Fields inherited from interface org.springframework.security.vote.AccessDecisionVoter
ACCESS_ABSTAIN, ACCESS_DENIED, ACCESS_GRANTED
 
Constructor Summary
BasicAclEntryVoter()
          Deprecated.  
 
Method Summary
 void afterPropertiesSet()
          Deprecated.  
 AclManager getAclManager()
          Deprecated.  
 String getInternalMethod()
          Deprecated. Optionally specifies a method of the domain object that will be used to obtain a contained domain object.
 String getProcessConfigAttribute()
          Deprecated.  
 int[] getRequirePermission()
          Deprecated.  
 void setAclManager(AclManager aclManager)
          Deprecated.  
 void setInternalMethod(String internalMethod)
          Deprecated.  
 void setProcessConfigAttribute(String processConfigAttribute)
          Deprecated.  
 void setRequirePermission(int[] requirePermission)
          Deprecated.  
 void setRequirePermissionFromString(String[] requirePermission)
          Deprecated. Allow setting permissions with String literals instead of integers as setRequirePermission(int[])
 boolean supports(ConfigAttribute attribute)
          Deprecated. Indicates whether this AccessDecisionVoter is able to vote on the passed ConfigAttribute.
 int vote(Authentication authentication, Object object, ConfigAttributeDefinition config)
          Deprecated. Indicates whether or not access is granted.
 
Methods inherited from class org.springframework.security.vote.AbstractAclVoter
getDomainObjectInstance, getProcessDomainObjectClass, setProcessDomainObjectClass, supports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicAclEntryVoter

public BasicAclEntryVoter()
Deprecated. 
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Deprecated. 
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getAclManager

public AclManager getAclManager()
Deprecated. 

getInternalMethod

public String getInternalMethod()
Deprecated. 
Optionally specifies a method of the domain object that will be used to obtain a contained domain object. That contained domain object will be used for the ACL evaluation. This is useful if a domain object contains a parent that an ACL evaluation should be targeted for, instead of the child domain object (which perhaps is being created and as such does not yet have any ACL permissions)

Returns:
null to use the domain object, or the name of a method (that requires no arguments) that should be invoked to obtain an Object which will be the domain object used for ACL evaluation

getProcessConfigAttribute

public String getProcessConfigAttribute()
Deprecated. 

getRequirePermission

public int[] getRequirePermission()
Deprecated. 

setAclManager

public void setAclManager(AclManager aclManager)
Deprecated. 

setInternalMethod

public void setInternalMethod(String internalMethod)
Deprecated. 

setProcessConfigAttribute

public void setProcessConfigAttribute(String processConfigAttribute)
Deprecated. 

setRequirePermission

public void setRequirePermission(int[] requirePermission)
Deprecated. 

setRequirePermissionFromString

public void setRequirePermissionFromString(String[] requirePermission)
Deprecated. 
Allow setting permissions with String literals instead of integers as setRequirePermission(int[])

Parameters:
requirePermission - Permission literals
See Also:
for valid values

supports

public boolean supports(ConfigAttribute attribute)
Deprecated. 
Description copied from interface: AccessDecisionVoter
Indicates whether this AccessDecisionVoter is able to vote on the passed ConfigAttribute.

This allows the AbstractSecurityInterceptor to check every configuration attribute can be consumed by the configured AccessDecisionManager and/or RunAsManager and/or AfterInvocationManager.

Specified by:
supports in interface AccessDecisionVoter
Parameters:
attribute - a configuration attribute that has been configured against the AbstractSecurityInterceptor
Returns:
true if this AccessDecisionVoter can support the passed configuration attribute

vote

public int vote(Authentication authentication,
                Object object,
                ConfigAttributeDefinition config)
Deprecated. 
Description copied from interface: AccessDecisionVoter
Indicates whether or not access is granted.

The decision must be affirmative (ACCESS_GRANTED), negative (ACCESS_DENIED) or the AccessDecisionVoter can abstain (ACCESS_ABSTAIN) from voting. Under no circumstances should implementing classes return any other value. If a weighting of results is desired, this should be handled in a custom AccessDecisionManager instead.

Unless an AccessDecisionVoter is specifically intended to vote on an access control decision due to a passed method invocation or configuration attribute parameter, it must return ACCESS_ABSTAIN. This prevents the coordinating AccessDecisionManager from counting votes from those AccessDecisionVoters without a legitimate interest in the access control decision.

Whilst the method invocation is passed as a parameter to maximise flexibility in making access control decisions, implementing classes must never modify the behaviour of the method invocation (such as calling MethodInvocation.proceed()).

Specified by:
vote in interface AccessDecisionVoter
Parameters:
authentication - the caller invoking the method
object - the secured object
config - the configuration attributes associated with the method being invoked
Returns:
either AccessDecisionVoter.ACCESS_GRANTED, AccessDecisionVoter.ACCESS_ABSTAIN or AccessDecisionVoter.ACCESS_DENIED

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.