Spring Security Framework

org.springframework.security.intercept.method
Class MethodDefinitionAttributes

java.lang.Object
  extended by org.springframework.security.intercept.method.AbstractFallbackMethodDefinitionSource
      extended by org.springframework.security.intercept.method.MethodDefinitionAttributes
All Implemented Interfaces:
InitializingBean, MethodDefinitionSource, ObjectDefinitionSource

public class MethodDefinitionAttributes
extends AbstractFallbackMethodDefinitionSource
implements InitializingBean

Provides ConfigAttributeDefinitions for a method signature (via the lookupAttributes method) by delegating to a configured Attributes object. The latter may use Commons attributes or some other approach to determine the ConfigAttributes which apply.

Note that attributes defined against parent classes (either for their methods or interfaces) are not detected. The attributes must be defined against an explicit method or interface on the intercepted class.

Attributes detected that do not implement ConfigAttribute will be ignored.

Version:
$Id$
Author:
Cameron Braid, Ben Alex

Constructor Summary
MethodDefinitionAttributes()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  ConfigAttributeDefinition findAttributes(Class clazz)
          Obtains the security metadata registered against the specified class.
protected  ConfigAttributeDefinition findAttributes(Method method, Class targetClass)
          Obtains the security metadata applicable to the specified method invocation.
 Collection getConfigAttributeDefinitions()
          If available, returns all of the ConfigAttributeDefinitions defined by the implementing class.
 void setAttributes(Attributes attributes)
           
 
Methods inherited from class org.springframework.security.intercept.method.AbstractFallbackMethodDefinitionSource
getAttributes, getAttributes, supports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodDefinitionAttributes

public MethodDefinitionAttributes()
Method Detail

afterPropertiesSet

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

getConfigAttributeDefinitions

public Collection getConfigAttributeDefinitions()
Description copied from interface: ObjectDefinitionSource
If available, returns all of the ConfigAttributeDefinitions defined by the implementing class.

This is used by the AbstractSecurityInterceptor to perform startup time validation of each ConfigAttribute configured against it.

Specified by:
getConfigAttributeDefinitions in interface ObjectDefinitionSource
Returns:
the ConfigAttributeDefinitions or null if unsupported

findAttributes

protected ConfigAttributeDefinition findAttributes(Class clazz)
Description copied from class: AbstractFallbackMethodDefinitionSource
Obtains the security metadata registered against the specified class.

Subclasses should only return metadata expressed at a class level. Subclasses should NOT aggregate metadata for each method registered against a class, as the abstract superclass will separate invoke AbstractFallbackMethodDefinitionSource.findAttributes(Method, Class) for individual methods as appropriate.

Specified by:
findAttributes in class AbstractFallbackMethodDefinitionSource
Parameters:
clazz - the target class for the invocation (never null)
Returns:
the security metadata (or null if no metadata applies)

findAttributes

protected ConfigAttributeDefinition findAttributes(Method method,
                                                   Class targetClass)
Description copied from class: AbstractFallbackMethodDefinitionSource
Obtains the security metadata applicable to the specified method invocation.

Note that the Method.getDeclaringClass() may not equal the targetClass. Both parameters are provided to assist subclasses which may wish to provide advanced capabilities related to method metadata being "registered" against a method even if the target class does not declare the method (i.e. the subclass may only inherit the method).

Specified by:
findAttributes in class AbstractFallbackMethodDefinitionSource
Parameters:
method - the method for the current invocation (never null)
targetClass - the target class for the invocation (may be null)
Returns:
the security metadata (or null if no metadata applies)

setAttributes

public void setAttributes(Attributes attributes)

Spring Security Framework

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