SEC-1768: Use AopProxyUtils.ultimateTargetClass to cater for situation where security interceptor is applied to a proxy.

This commit is contained in:
Luke Taylor 2011-06-18 14:46:28 +01:00
parent 9b8d2719a6
commit cb7a94af88

View File

@ -15,6 +15,7 @@
package org.springframework.security.access.method;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.security.access.ConfigAttribute;
import org.aopalliance.intercept.MethodInvocation;
@ -52,7 +53,12 @@ public abstract class AbstractMethodSecurityMetadataSource implements MethodSecu
Class<?> targetClass = null;
if (target != null) {
targetClass = target instanceof Class<?> ? (Class<?>)target : target.getClass();
targetClass = target instanceof Class<?> ? (Class<?>)target : AopProxyUtils.ultimateTargetClass(target);
if (targetClass == null) {
// See SPR-7447. TODO: Only required for Spring < 3.0.4
targetClass = target.getClass();
}
}
return getAttributes(mi.getMethod(), targetClass);