public class MapBasedMethodSecurityMetadataSource extends AbstractFallbackMethodSecurityMetadataSource implements 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 Map<org.springframework.security.access.method.MapBasedMethodSecurityMetadataSource.RegisteredMethod,List<ConfigAttribute>> |
methodMap
Map from RegisteredMethod to ConfigAttribute list
|
logger
Constructor and Description |
---|
MapBasedMethodSecurityMetadataSource() |
MapBasedMethodSecurityMetadataSource(Map<String,List<ConfigAttribute>> methodMap)
Creates the MapBasedMethodSecurityMetadataSource from a
|
Modifier and Type | Method and Description |
---|---|
void |
addSecureMethod(Class<?> javaType,
Method method,
List<ConfigAttribute> attr)
Adds configuration attributes for a specific method, for example where the method
has been matched using a pointcut expression.
|
void |
addSecureMethod(Class<?> javaType,
String mappedName,
List<ConfigAttribute> attr)
Add configuration attributes for a secure method.
|
protected Collection<ConfigAttribute> |
findAttributes(Class<?> clazz)
Implementation does not support class-level attributes.
|
protected Collection<ConfigAttribute> |
findAttributes(Method method,
Class<?> targetClass)
Will walk the method inheritance tree to find the most specific declaration
applicable.
|
Collection<ConfigAttribute> |
getAllConfigAttributes()
Obtains the configuration attributes explicitly defined against this bean.
|
int |
getMethodMapSize() |
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
getAttributes
getAttributes, supports
protected final Map<org.springframework.security.access.method.MapBasedMethodSecurityMetadataSource.RegisteredMethod,List<ConfigAttribute>> methodMap
public MapBasedMethodSecurityMetadataSource()
public MapBasedMethodSecurityMetadataSource(Map<String,List<ConfigAttribute>> methodMap)
methodMap
- map of method names to ConfigAttributes.protected Collection<ConfigAttribute> findAttributes(Class<?> clazz)
findAttributes
in class AbstractFallbackMethodSecurityMetadataSource
clazz
- the target class for the invocation (never null
)protected Collection<ConfigAttribute> findAttributes(Method method, 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(Class<?> javaType, String mappedName, 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(Class<?> javaType, Method method, List<ConfigAttribute> attr)
This method should only be called during initialization of the BeanFactory
.
public Collection<ConfigAttribute> getAllConfigAttributes()
getAllConfigAttributes
in interface SecurityMetadataSource
public void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public int getMethodMapSize()