Class MethodSecurityMetadataSourceAdvisor
- java.lang.Object
-
- org.springframework.aop.support.AbstractPointcutAdvisor
-
- org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor
-
- All Implemented Interfaces:
java.io.Serializable
,org.springframework.aop.Advisor
,org.springframework.aop.PointcutAdvisor
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.core.Ordered
public class MethodSecurityMetadataSourceAdvisor extends org.springframework.aop.support.AbstractPointcutAdvisor implements org.springframework.beans.factory.BeanFactoryAware
Advisor driven by aMethodSecurityMetadataSource
, used to exclude aMethodInterceptor
from public (non-secure) methods.Because the AOP framework caches advice calculations, this is normally faster than just letting the
MethodInterceptor
run and find out itself that it has no work to do.This class also allows the use of Spring's
DefaultAdvisorAutoProxyCreator
, which makes configuration easier than setup aProxyFactoryBean
for each object requiring security. Note that autoproxying is not supported for BeanFactory implementations, as post-processing is automatic only for application contexts.Based on Spring's TransactionAttributeSourceAdvisor.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MethodSecurityMetadataSourceAdvisor(java.lang.String adviceBeanName, MethodSecurityMetadataSource attributeSource, java.lang.String attributeSourceBeanName)
Alternative constructor for situations where we want the advisor decoupled from the advice.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.aopalliance.aop.Advice
getAdvice()
org.springframework.aop.Pointcut
getPointcut()
void
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
-
-
-
Constructor Detail
-
MethodSecurityMetadataSourceAdvisor
public MethodSecurityMetadataSourceAdvisor(java.lang.String adviceBeanName, MethodSecurityMetadataSource attributeSource, java.lang.String attributeSourceBeanName)
Alternative constructor for situations where we want the advisor decoupled from the advice. Instead the advice bean name should be set. This prevents eager instantiation of the interceptor (and hence the AuthenticationManager). See SEC-773, for example. The metadataSourceBeanName is used rather than a direct reference to support serialization via a bean factory lookup.- Parameters:
adviceBeanName
- name of the MethodSecurityInterceptor beanattributeSource
- the SecurityMetadataSource (should be the same as the one used on the interceptor)attributeSourceBeanName
- the bean name of the attributeSource (required for serialization)
-
-
Method Detail
-
getPointcut
public org.springframework.aop.Pointcut getPointcut()
- Specified by:
getPointcut
in interfaceorg.springframework.aop.PointcutAdvisor
-
getAdvice
public org.aopalliance.aop.Advice getAdvice()
- Specified by:
getAdvice
in interfaceorg.springframework.aop.Advisor
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
-