mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-08 13:12:12 +00:00
SEC-1768: Use AopProxyUtils.ultimateTargetClass to cater for situation where security interceptor is applied to a proxy.
This commit is contained in:
parent
9b8d2719a6
commit
cb7a94af88
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
package org.springframework.security.access.method;
|
package org.springframework.security.access.method;
|
||||||
|
|
||||||
|
import org.springframework.aop.framework.AopProxyUtils;
|
||||||
import org.springframework.security.access.ConfigAttribute;
|
import org.springframework.security.access.ConfigAttribute;
|
||||||
|
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
@ -52,7 +53,12 @@ public abstract class AbstractMethodSecurityMetadataSource implements MethodSecu
|
|||||||
Class<?> targetClass = null;
|
Class<?> targetClass = null;
|
||||||
|
|
||||||
if (target != 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);
|
return getAttributes(mi.getMethod(), targetClass);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user