public class

SecuredAnnotationSecurityMetadataSource

extends AbstractFallbackMethodSecurityMetadataSource
java.lang.Object
   ↳ org.springframework.security.access.method.AbstractMethodSecurityMetadataSource
     ↳ org.springframework.security.access.method.AbstractFallbackMethodSecurityMetadataSource
       ↳ org.springframework.security.access.annotation.SecuredAnnotationSecurityMetadataSource

Class Overview

Sources method security metadata from Spring Security's Secured annotation.

Can also be used with custom security annotations by injecting an AnnotationMetadataExtractor. The annotation type will then be obtained from the generic parameter type supplied to this interface

Summary

[Expand]
Inherited Fields
From class org.springframework.security.access.method.AbstractMethodSecurityMetadataSource
Public Constructors
SecuredAnnotationSecurityMetadataSource()
SecuredAnnotationSecurityMetadataSource(AnnotationMetadataExtractor annotationMetadataExtractor)
Public Methods
Collection<ConfigAttribute> getAllConfigAttributes()
Protected Methods
Collection<ConfigAttribute> findAttributes(Class<?> clazz)
Obtains the security metadata registered against the specified class.
Collection<ConfigAttribute> findAttributes(Method method, Class<?> targetClass)
Obtains the security metadata applicable to the specified method invocation.
[Expand]
Inherited Methods
From class org.springframework.security.access.method.AbstractFallbackMethodSecurityMetadataSource
From class org.springframework.security.access.method.AbstractMethodSecurityMetadataSource
From class java.lang.Object
From interface org.springframework.security.access.SecurityMetadataSource
From interface org.springframework.security.access.method.MethodSecurityMetadataSource

Public Constructors

public SecuredAnnotationSecurityMetadataSource ()

public SecuredAnnotationSecurityMetadataSource (AnnotationMetadataExtractor annotationMetadataExtractor)

Public Methods

public Collection<ConfigAttribute> getAllConfigAttributes ()

Protected Methods

protected Collection<ConfigAttribute> findAttributes (Class<?> clazz)

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 findAttributes(Method, Class) for individual methods as appropriate.

Parameters
clazz the target class for the invocation (never null)
Returns
  • the security metadata (or null if no metadata applies)

protected Collection<ConfigAttribute> findAttributes (Method method, Class<?> targetClass)

Obtains the security metadata applicable to the specified method invocation.

Note that the 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).

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)