Removed commented out line.
This commit is contained in:
parent
ef44bd91f2
commit
1d96283876
|
@ -33,7 +33,7 @@ import org.springframework.util.Assert;
|
||||||
* Advisor driven by a {@link MethodDefinitionSource}, used to exclude a {@link MethodSecurityInterceptor} from
|
* Advisor driven by a {@link MethodDefinitionSource}, used to exclude a {@link MethodSecurityInterceptor} from
|
||||||
* public (ie non-secure) methods.
|
* public (ie non-secure) methods.
|
||||||
* <p>
|
* <p>
|
||||||
* Because the AOP framework caches advice calculations, this is normally faster than just letting the
|
* Because the AOP framework caches advice calculations, this is normally faster than just letting the
|
||||||
* <code>MethodSecurityInterceptor</code> run and find out itself that it has no work to do.
|
* <code>MethodSecurityInterceptor</code> run and find out itself that it has no work to do.
|
||||||
* <p>
|
* <p>
|
||||||
* This class also allows the use of Spring's
|
* This class also allows the use of Spring's
|
||||||
|
@ -63,64 +63,63 @@ public class MethodDefinitionSourceAdvisor extends AbstractPointcutAdvisor imple
|
||||||
* @deprecated use the decoupled approach instead
|
* @deprecated use the decoupled approach instead
|
||||||
*/
|
*/
|
||||||
public MethodDefinitionSourceAdvisor(MethodSecurityInterceptor advice) {
|
public MethodDefinitionSourceAdvisor(MethodSecurityInterceptor advice) {
|
||||||
Assert.notNull(advice.getObjectDefinitionSource(), "Cannot construct a MethodDefinitionSourceAdvisor using a " +
|
Assert.notNull(advice.getObjectDefinitionSource(), "Cannot construct a MethodDefinitionSourceAdvisor using a " +
|
||||||
"MethodSecurityInterceptor that has no ObjectDefinitionSource configured");
|
"MethodSecurityInterceptor that has no ObjectDefinitionSource configured");
|
||||||
|
|
||||||
this.interceptor = advice;
|
this.interceptor = advice;
|
||||||
this.attributeSource = advice.getObjectDefinitionSource();
|
this.attributeSource = advice.getObjectDefinitionSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alternative constructor for situations where we want the advisor decoupled from the advice. Instead the advice
|
* 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
|
* bean name should be set. This prevents eager instantiation of the interceptor
|
||||||
* (and hence the AuthenticationManager). See SEC-773, for example.
|
* (and hence the AuthenticationManager). See SEC-773, for example.
|
||||||
* <p>
|
* <p>
|
||||||
* This is essentially the approach taken by subclasses of {@link AbstractBeanFactoryPointcutAdvisor}, which this
|
* This is essentially the approach taken by subclasses of {@link AbstractBeanFactoryPointcutAdvisor}, which this
|
||||||
* class should extend in future. The original hierarchy and constructor have been retained for backwards
|
* class should extend in future. The original hierarchy and constructor have been retained for backwards
|
||||||
* compatibility.
|
* compatibility.
|
||||||
*
|
*
|
||||||
* @param adviceBeanName name of the MethodSecurityInterceptor bean
|
* @param adviceBeanName name of the MethodSecurityInterceptor bean
|
||||||
* @param attributeSource the attribute source (should be the same as the one used on the interceptor)
|
* @param attributeSource the attribute source (should be the same as the one used on the interceptor)
|
||||||
*/
|
*/
|
||||||
public MethodDefinitionSourceAdvisor(String adviceBeanName, MethodDefinitionSource attributeSource) {
|
public MethodDefinitionSourceAdvisor(String adviceBeanName, MethodDefinitionSource attributeSource) {
|
||||||
Assert.notNull(adviceBeanName, "The adviceBeanName cannot be null");
|
Assert.notNull(adviceBeanName, "The adviceBeanName cannot be null");
|
||||||
Assert.notNull(attributeSource, "The attributeSource cannot be null");
|
Assert.notNull(attributeSource, "The attributeSource cannot be null");
|
||||||
|
|
||||||
this.adviceBeanName = adviceBeanName;
|
this.adviceBeanName = adviceBeanName;
|
||||||
this.attributeSource = attributeSource;
|
this.attributeSource = attributeSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~ Methods ========================================================================================================
|
//~ Methods ========================================================================================================
|
||||||
|
|
||||||
public Pointcut getPointcut() {
|
public Pointcut getPointcut() {
|
||||||
return pointcut;
|
return pointcut;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Advice getAdvice() {
|
public Advice getAdvice() {
|
||||||
synchronized (this.adviceMonitor) {
|
synchronized (this.adviceMonitor) {
|
||||||
if (interceptor == null) {
|
if (interceptor == null) {
|
||||||
Assert.notNull(adviceBeanName, "'adviceBeanName' must be set for use with bean factory lookup.");
|
Assert.notNull(adviceBeanName, "'adviceBeanName' must be set for use with bean factory lookup.");
|
||||||
Assert.state(beanFactory != null, "BeanFactory must be set to resolve 'adviceBeanName'");
|
Assert.state(beanFactory != null, "BeanFactory must be set to resolve 'adviceBeanName'");
|
||||||
interceptor = (MethodSecurityInterceptor)
|
interceptor = (MethodSecurityInterceptor)
|
||||||
beanFactory.getBean(this.adviceBeanName, MethodSecurityInterceptor.class);
|
beanFactory.getBean(this.adviceBeanName, MethodSecurityInterceptor.class);
|
||||||
// attributeSource = interceptor.getObjectDefinitionSource();
|
}
|
||||||
}
|
return interceptor;
|
||||||
return interceptor;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
this.beanFactory = beanFactory;
|
||||||
this.beanFactory = beanFactory;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//~ Inner Classes ==================================================================================================
|
//~ Inner Classes ==================================================================================================
|
||||||
|
|
||||||
class MethodDefinitionSourcePointcut extends StaticMethodMatcherPointcut {
|
class MethodDefinitionSourcePointcut extends StaticMethodMatcherPointcut {
|
||||||
public boolean matches(Method m, Class targetClass) {
|
public boolean matches(Method m, Class targetClass) {
|
||||||
return attributeSource.getAttributes(m, targetClass) != null;
|
return attributeSource.getAttributes(m, targetClass) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a <code>MethodInvocation</code>.
|
* Represents a <code>MethodInvocation</code>.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -153,7 +152,7 @@ public class MethodDefinitionSourceAdvisor extends AbstractPointcutAdvisor imple
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getThis() {
|
public Object getThis() {
|
||||||
return this.targetClass;
|
return this.targetClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object proceed() throws Throwable {
|
public Object proceed() throws Throwable {
|
||||||
|
|
Loading…
Reference in New Issue