Reflect new secure object API, which is no longer bound to MethodInvocations.

This commit is contained in:
Ben Alex 2004-04-02 12:05:49 +00:00
parent 3ece12c386
commit e54ad9b4e8
2 changed files with 55 additions and 37 deletions

View File

@ -15,9 +15,6 @@
package net.sf.acegisecurity; package net.sf.acegisecurity;
import org.aopalliance.intercept.MethodInvocation;
/** /**
* Makes a final access control (authorization) decision. * Makes a final access control (authorization) decision.
* *
@ -31,32 +28,43 @@ public interface AccessDecisionManager {
* Resolves an access control decision for the passed parameters. * Resolves an access control decision for the passed parameters.
* *
* @param authentication the caller invoking the method * @param authentication the caller invoking the method
* @param invocation the method being called * @param object the secured object being called
* @param config the configuration attributes associated with the method * @param config the configuration attributes associated with the secured
* being invoked * object being invoked
* *
* @throws AccessDeniedException if access is denied * @throws AccessDeniedException if access is denied
*/ */
public void decide(Authentication authentication, public void decide(Authentication authentication, Object object,
MethodInvocation invocation, ConfigAttributeDefinition config) ConfigAttributeDefinition config) throws AccessDeniedException;
throws AccessDeniedException;
/** /**
* Indicates whether this <code>AccessDecisionManager</code> is able to * Indicates whether this <code>AccessDecisionManager</code> is able to
* process authorization requests presented with the passed * process authorization requests presented with the passed
* <code>ConfigAttribute</code>. * <code>ConfigAttribute</code>.
* *
* <p> * <p>
* This allows the <code>SecurityInterceptor</code> to check every * This allows the <code>AbstractSecurityInterceptor</code> to check every
* configuration attribute can be consumed by the configured * configuration attribute can be consumed by the configured
* <code>AccessDecisionManager</code> and/or <code>RunAsManager</code>. * <code>AccessDecisionManager</code> and/or <code>RunAsManager</code>.
* </p> * </p>
* *
* @param attribute a configuration attribute that has been configured * @param attribute a configuration attribute that has been configured
* against the <code>SecurityInterceptor</code> * against the <code>AbstractSecurityInterceptor</code>
* *
* @return true if this <code>AccessDecisionManager</code> can support the * @return true if this <code>AccessDecisionManager</code> can support the
* passed configuration attribute * passed configuration attribute
*/ */
public boolean supports(ConfigAttribute attribute); public boolean supports(ConfigAttribute attribute);
/**
* Indicates whether the <code>AccessDecisionManager</code> implementation
* is able to provide access control decisions for the indicated secured
* object type.
*
* @param clazz the class that is being queried
*
* @return <code>true</code> if the implementation can process the
* indicated class
*/
public boolean supports(Class clazz);
} }

View File

@ -15,21 +15,19 @@
package net.sf.acegisecurity; package net.sf.acegisecurity;
import org.aopalliance.intercept.MethodInvocation;
/** /**
* Creates a new temporary {@link Authentication} object for the current method * Creates a new temporary {@link Authentication} object for the current secure
* invocation only. * object invocation only.
* *
* <P> * <P>
* This interface permits implementations to replace the * This interface permits implementations to replace the
* <code>Authentication</code> object that applies to the current method * <code>Authentication</code> object that applies to the current secure
* invocation only. The {@link SecurityInterceptor} will replace the * object invocation only. The {@link
* <code>Authentication</code> object held in the {@link * net.sf.acegisecurity.intercept.AbstractSecurityInterceptor} will replace
* net.sf.acegisecurity.context.SecureContext} for the duration of the method * the <code>Authentication</code> object held in the {@link
* invocation only, returning it to the original <code>Authentication</code> * net.sf.acegisecurity.context.SecureContext} for the duration of the secure
* object when the method invocation completes. * object callback only, returning it to the original
* <code>Authentication</code> object when the callback ends.
* </p> * </p>
* *
* <P> * <P>
@ -49,8 +47,8 @@ import org.aopalliance.intercept.MethodInvocation;
* <p> * <p>
* It is expected implementations will provide a corresponding concrete * It is expected implementations will provide a corresponding concrete
* <code>Authentication</code> and <code>AuthenticationProvider</code> so that * <code>Authentication</code> and <code>AuthenticationProvider</code> so that
* the replacement <code>Authentication</code> object can be authenticated. * the replacement <code>Authentication</code> object can be authenticated.
* Some form of security will need to be implemented to prevent to ensure the * Some form of security will need to be implemented to ensure the
* <code>AuthenticationProvider</code> only accepts * <code>AuthenticationProvider</code> only accepts
* <code>Authentication</code> objects created by an authorized concrete * <code>Authentication</code> objects created by an authorized concrete
* implementation of <code>RunAsManager</code>. * implementation of <code>RunAsManager</code>.
@ -64,34 +62,46 @@ public interface RunAsManager {
/** /**
* Returns a replacement <code>Authentication</code> object for the current * Returns a replacement <code>Authentication</code> object for the current
* method invocation, or <code>null</code> if replacement not required. * secure object invocation, or <code>null</code> if replacement not
* required.
* *
* @param authentication the caller invoking the method * @param authentication the caller invoking the secure object
* @param invocation the method being called * @param object the secured object being called
* @param config the configuration attributes associated with the method * @param config the configuration attributes associated with the secure
* being invoked * object being invoked
* *
* @return a replacement object to be used for duration of the method * @return a replacement object to be used for duration of the secure
* invocation * object invocation, or <code>null</code> if the
* <code>Authentication</code> should be left as is
*/ */
public Authentication buildRunAs(Authentication authentication, public Authentication buildRunAs(Authentication authentication,
MethodInvocation invocation, ConfigAttributeDefinition config); Object object, ConfigAttributeDefinition config);
/** /**
* Indicates whether this <code>RunAsManager</code> is able to process the * Indicates whether this <code>RunAsManager</code> is able to process the
* passed <code>ConfigAttribute</code>. * passed <code>ConfigAttribute</code>.
* *
* <p> * <p>
* This allows the <code>SecurityInterceptor</code> to check every * This allows the <code>AbstractSecurityInterceptor</code> to check every
* configuration attribute can be consumed by the configured * configuration attribute can be consumed by the configured
* <code>AccessDecisionManager</code> and/or <code>RunAsManager</code>. * <code>AccessDecisionManager</code> and/or <code>RunAsManager</code>.
* </p> * </p>
* *
* @param attribute a configuration attribute that has been configured * @param attribute a configuration attribute that has been configured
* against the <code>SecurityInterceptor</code> * against the <code>AbstractSecurityInterceptor</code>
* *
* @return true if this <code>RunAsManager</code> can support the passed * @return <code>true</code> if this <code>RunAsManager</code> can support
* configuration attribute * the passed configuration attribute
*/ */
public boolean supports(ConfigAttribute attribute); public boolean supports(ConfigAttribute attribute);
/**
* Indicates whether the <code>RunAsManager</code> 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);
} }