public class MapBasedMethodSecurityMetadataSource extends AbstractFallbackMethodSecurityMetadataSource implements org.springframework.beans.factory.BeanClassLoaderAware
This class is the preferred implementation of MethodSecurityMetadataSource
for
XML-based definition of method security metadata. To assist in XML-based definition,
wildcard support is provided.
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<org.springframework.security.access.method.MapBasedMethodSecurityMetadataSource.RegisteredMethod,java.util.List<ConfigAttribute>> |
methodMap
Map from RegisteredMethod to ConfigAttribute list
|
logger
Constructor and Description |
---|
MapBasedMethodSecurityMetadataSource() |
MapBasedMethodSecurityMetadataSource(java.util.Map<java.lang.String,java.util.List<ConfigAttribute>> methodMap)
Creates the MapBasedMethodSecurityMetadataSource from a
|
Modifier and Type | Method and Description |
---|---|
void |
addSecureMethod(java.lang.Class<?> javaType,
java.lang.reflect.Method method,
java.util.List<ConfigAttribute> attr)
Adds configuration attributes for a specific method, for example where the method
has been matched using a pointcut expression.
|
void |
addSecureMethod(java.lang.Class<?> javaType,
java.lang.String mappedName,
java.util.List<ConfigAttribute> attr)
Add configuration attributes for a secure method.
|
protected java.util.Collection<ConfigAttribute> |
findAttributes(java.lang.Class<?> clazz)
Implementation does not support class-level attributes.
|
protected java.util.Collection<ConfigAttribute> |
findAttributes(java.lang.reflect.Method method,
java.lang.Class<?> targetClass)
Will walk the method inheritance tree to find the most specific declaration
applicable.
|
java.util.Collection<ConfigAttribute> |
getAllConfigAttributes()
Obtains the configuration attributes explicitly defined against this bean.
|
int |
getMethodMapSize() |
void |
setBeanClassLoader(java.lang.ClassLoader beanClassLoader) |
getAttributes
getAttributes, supports
protected final java.util.Map<org.springframework.security.access.method.MapBasedMethodSecurityMetadataSource.RegisteredMethod,java.util.List<ConfigAttribute>> methodMap
public MapBasedMethodSecurityMetadataSource()
public MapBasedMethodSecurityMetadataSource(java.util.Map<java.lang.String,java.util.List<ConfigAttribute>> methodMap)
methodMap
- map of method names to ConfigAttributes.protected java.util.Collection<ConfigAttribute> findAttributes(java.lang.Class<?> clazz)
findAttributes
in class AbstractFallbackMethodSecurityMetadataSource
clazz
- the target class for the invocation (never null
)protected java.util.Collection<ConfigAttribute> findAttributes(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
findAttributes
in class AbstractFallbackMethodSecurityMetadataSource
method
- the method for the current invocation (never null
)targetClass
- the target class for the invocation (may be null
)public void addSecureMethod(java.lang.Class<?> javaType, java.lang.String mappedName, java.util.List<ConfigAttribute> attr)
*
for matching multiple methods.javaType
- target interface or class the security configuration attribute
applies tomappedName
- mapped method name, which the javaType has declared or inheritedattr
- required authorities associated with the methodpublic void addSecureMethod(java.lang.Class<?> javaType, java.lang.reflect.Method method, java.util.List<ConfigAttribute> attr)
This method should only be called during initialization of the BeanFactory
.
public java.util.Collection<ConfigAttribute> getAllConfigAttributes()
getAllConfigAttributes
in interface SecurityMetadataSource
public void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
setBeanClassLoader
in interface org.springframework.beans.factory.BeanClassLoaderAware
public int getMethodMapSize()