From d253f5e1096547e74886c9c7038802cc9da5543c Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sat, 18 Jun 2011 14:35:56 +0100 Subject: [PATCH] SEC-1768: Use AopProxyUtils.ultimateTargetClass() to cater for the situation where the security interceptor is being applied to a proxy. --- .../access/method/AbstractMethodSecurityMetadataSource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/springframework/security/access/method/AbstractMethodSecurityMetadataSource.java b/core/src/main/java/org/springframework/security/access/method/AbstractMethodSecurityMetadataSource.java index 3c6a42bb4a..50259d2ac1 100644 --- a/core/src/main/java/org/springframework/security/access/method/AbstractMethodSecurityMetadataSource.java +++ b/core/src/main/java/org/springframework/security/access/method/AbstractMethodSecurityMetadataSource.java @@ -20,6 +20,7 @@ import java.util.Collection; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.aop.framework.AopProxyUtils; import org.springframework.security.access.ConfigAttribute; @@ -43,7 +44,7 @@ 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); } return getAttributes(mi.getMethod(), targetClass);