diff --git a/core/src/main/java/org/acegisecurity/AccessDecisionManager.java b/core/src/main/java/org/acegisecurity/AccessDecisionManager.java index fba4d0c533..eb79ce5ec3 100644 --- a/core/src/main/java/org/acegisecurity/AccessDecisionManager.java +++ b/core/src/main/java/org/acegisecurity/AccessDecisionManager.java @@ -15,9 +15,6 @@ package net.sf.acegisecurity; -import org.aopalliance.intercept.MethodInvocation; - - /** * Makes a final access control (authorization) decision. * @@ -31,32 +28,43 @@ public interface AccessDecisionManager { * Resolves an access control decision for the passed parameters. * * @param authentication the caller invoking the method - * @param invocation the method being called - * @param config the configuration attributes associated with the method - * being invoked + * @param object the secured object being called + * @param config the configuration attributes associated with the secured + * object being invoked * * @throws AccessDeniedException if access is denied */ - public void decide(Authentication authentication, - MethodInvocation invocation, ConfigAttributeDefinition config) - throws AccessDeniedException; + public void decide(Authentication authentication, Object object, + ConfigAttributeDefinition config) throws AccessDeniedException; /** * Indicates whether this AccessDecisionManager is able to * process authorization requests presented with the passed * ConfigAttribute. - * + * *

- * This allows the SecurityInterceptor to check every + * This allows the AbstractSecurityInterceptor to check every * configuration attribute can be consumed by the configured * AccessDecisionManager and/or RunAsManager. *

* * @param attribute a configuration attribute that has been configured - * against the SecurityInterceptor + * against the AbstractSecurityInterceptor * * @return true if this AccessDecisionManager can support the * passed configuration attribute */ public boolean supports(ConfigAttribute attribute); + + /** + * Indicates whether the AccessDecisionManager implementation + * is able to provide access control decisions for the indicated secured + * object type. + * + * @param clazz the class that is being queried + * + * @return true if the implementation can process the + * indicated class + */ + public boolean supports(Class clazz); } diff --git a/core/src/main/java/org/acegisecurity/RunAsManager.java b/core/src/main/java/org/acegisecurity/RunAsManager.java index 4e53186e9e..a8765c71d0 100644 --- a/core/src/main/java/org/acegisecurity/RunAsManager.java +++ b/core/src/main/java/org/acegisecurity/RunAsManager.java @@ -15,21 +15,19 @@ package net.sf.acegisecurity; -import org.aopalliance.intercept.MethodInvocation; - - /** - * Creates a new temporary {@link Authentication} object for the current method - * invocation only. + * Creates a new temporary {@link Authentication} object for the current secure + * object invocation only. * *

* This interface permits implementations to replace the - * Authentication object that applies to the current method - * invocation only. The {@link SecurityInterceptor} will replace the - * Authentication object held in the {@link - * net.sf.acegisecurity.context.SecureContext} for the duration of the method - * invocation only, returning it to the original Authentication - * object when the method invocation completes. + * Authentication object that applies to the current secure + * object invocation only. The {@link + * net.sf.acegisecurity.intercept.AbstractSecurityInterceptor} will replace + * the Authentication object held in the {@link + * net.sf.acegisecurity.context.SecureContext} for the duration of the secure + * object callback only, returning it to the original + * Authentication object when the callback ends. *

* *

@@ -49,8 +47,8 @@ import org.aopalliance.intercept.MethodInvocation; *

* It is expected implementations will provide a corresponding concrete * Authentication and AuthenticationProvider so that - * the replacement Authentication object can be authenticated. - * Some form of security will need to be implemented to prevent to ensure the + * the replacement Authentication object can be authenticated. + * Some form of security will need to be implemented to ensure the * AuthenticationProvider only accepts * Authentication objects created by an authorized concrete * implementation of RunAsManager. @@ -64,34 +62,46 @@ public interface RunAsManager { /** * Returns a replacement Authentication object for the current - * method invocation, or null if replacement not required. + * secure object invocation, or null if replacement not + * required. * - * @param authentication the caller invoking the method - * @param invocation the method being called - * @param config the configuration attributes associated with the method - * being invoked + * @param authentication the caller invoking the secure object + * @param object the secured object being called + * @param config the configuration attributes associated with the secure + * object being invoked * - * @return a replacement object to be used for duration of the method - * invocation + * @return a replacement object to be used for duration of the secure + * object invocation, or null if the + * Authentication should be left as is */ public Authentication buildRunAs(Authentication authentication, - MethodInvocation invocation, ConfigAttributeDefinition config); + Object object, ConfigAttributeDefinition config); /** * Indicates whether this RunAsManager is able to process the * passed ConfigAttribute. * *

- * This allows the SecurityInterceptor to check every + * This allows the AbstractSecurityInterceptor to check every * configuration attribute can be consumed by the configured * AccessDecisionManager and/or RunAsManager. *

* * @param attribute a configuration attribute that has been configured - * against the SecurityInterceptor + * against the AbstractSecurityInterceptor * - * @return true if this RunAsManager can support the passed - * configuration attribute + * @return true if this RunAsManager can support + * the passed configuration attribute */ public boolean supports(ConfigAttribute attribute); + + /** + * Indicates whether the RunAsManager implementation is able + * to provide run-as replacement for the indicated secure object type. + * + * @param clazz the class that is being queried + * + * @return true if the implementation can process the indicated class + */ + public boolean supports(Class clazz); }