2
0
Эх сурвалжийг харах

SEC-995: AbstractSecurityInterceptor exception message improvement. Added the secured object to the exception message to make it easier to track down the originating method which causes a problem with public invocations.

Luke Taylor 17 жил өмнө
parent
commit
30f9b3e72c

+ 4 - 4
core/src/main/java/org/springframework/security/intercept/AbstractSecurityInterceptor.java

@@ -99,7 +99,7 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean, A
         MessageSourceAware {
     //~ Static fields/initializers =====================================================================================
 
-    protected static final Log logger = LogFactory.getLog(AbstractSecurityInterceptor.class);
+    protected final Log logger = LogFactory.getLog(getClass());
 
     //~ Instance fields ================================================================================================
 
@@ -175,10 +175,10 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean, A
 
         if (attributes == null) {
             if (rejectPublicInvocations) {
-                throw new IllegalArgumentException(
-                        "No public invocations are allowed via this AbstractSecurityInterceptor. "
+                throw new IllegalArgumentException("Secure object invocation " + object +
+                        " was denied as public invocations are not allowed via this interceptor. "
                                 + "This indicates a configuration error because the "
-                                + "AbstractSecurityInterceptor.rejectPublicInvocations property is set to 'true'");
+                                + "rejectPublicInvocations property is set to 'true'");
             }
 
             if (logger.isDebugEnabled()) {