org.springframework.security.access.intercept.aopalliance
Class MethodSecurityMetadataSourceAdvisor
java.lang.Object
org.springframework.aop.support.AbstractPointcutAdvisor
org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor
- All Implemented Interfaces:
- Serializable, Advisor, PointcutAdvisor, BeanFactoryAware, Ordered
public class MethodSecurityMetadataSourceAdvisor
- extends AbstractPointcutAdvisor
- implements BeanFactoryAware
Advisor driven by a MethodSecurityMetadataSource
, used to exclude a MethodSecurityInterceptor
from
public (ie non-secure) methods.
Because the AOP framework caches advice calculations, this is normally faster than just letting the
MethodSecurityInterceptor
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 a ProxyFactoryBean
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.
- Version:
- $Id: MethodSecurityMetadataSourceAdvisor.java 3655 2009-05-11 05:44:31Z ltaylor $
- Author:
- Ben Alex
- See Also:
- Serialized Form
MethodSecurityMetadataSourceAdvisor
public MethodSecurityMetadataSourceAdvisor(MethodSecurityInterceptor advice)
- Deprecated. use the decoupled approach instead
MethodSecurityMetadataSourceAdvisor
public MethodSecurityMetadataSourceAdvisor(String adviceBeanName,
MethodSecurityMetadataSource attributeSource)
- 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.
This is essentially the approach taken by subclasses of AbstractBeanFactoryPointcutAdvisor
, which this
class should extend in future. The original hierarchy and constructor have been retained for backwards
compatibility.
- Parameters:
adviceBeanName
- name of the MethodSecurityInterceptor beanattributeSource
- the attribute source (should be the same as the one used on the interceptor)
getPointcut
public Pointcut getPointcut()
- Specified by:
getPointcut
in interface PointcutAdvisor
getAdvice
public org.aopalliance.aop.Advice getAdvice()
- Specified by:
getAdvice
in interface Advisor
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
throws BeansException
- Specified by:
setBeanFactory
in interface BeanFactoryAware
- Throws:
BeansException
Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.