|
@@ -22,16 +22,14 @@ import org.springframework.security.core.Authentication;
|
|
|
|
|
|
/**
|
|
|
* Indicates a class is responsible for voting on authorization decisions.
|
|
|
- *
|
|
|
* <p>
|
|
|
- * The coordination of voting (ie polling <code>AccessDecisionVoter</code>s,
|
|
|
+ * The coordination of voting (ie polling {@code AccessDecisionVoter}s,
|
|
|
* tallying their responses, and making the final authorization decision) is
|
|
|
* performed by an {@link org.springframework.security.access.AccessDecisionManager}.
|
|
|
- * </p>
|
|
|
*
|
|
|
* @author Ben Alex
|
|
|
*/
|
|
|
-public interface AccessDecisionVoter {
|
|
|
+public interface AccessDecisionVoter<S> {
|
|
|
//~ Static fields/initializers =====================================================================================
|
|
|
|
|
|
int ACCESS_GRANTED = 1;
|
|
@@ -41,20 +39,20 @@ public interface AccessDecisionVoter {
|
|
|
//~ Methods ========================================================================================================
|
|
|
|
|
|
/**
|
|
|
- * Indicates whether this <code>AccessDecisionVoter</code> is able to vote on the passed
|
|
|
- * <code>ConfigAttribute</code>.<p>This allows the <code>AbstractSecurityInterceptor</code> to check every
|
|
|
- * configuration attribute can be consumed by the configured <code>AccessDecisionManager</code> and/or
|
|
|
- * <code>RunAsManager</code> and/or <code>AfterInvocationManager</code>.</p>
|
|
|
+ * Indicates whether this {@code AccessDecisionVoter} is able to vote on the passed {@code ConfigAttribute}.
|
|
|
+ * <p>
|
|
|
+ * This allows the {@code AbstractSecurityInterceptor} to check every configuration attribute can be consumed by
|
|
|
+ * the configured {@code AccessDecisionManager} and/or {@code RunAsManager} and/or {@code AfterInvocationManager}.
|
|
|
*
|
|
|
* @param attribute a configuration attribute that has been configured against the
|
|
|
- * <code>AbstractSecurityInterceptor</code>
|
|
|
+ * {@code AbstractSecurityInterceptor}
|
|
|
*
|
|
|
- * @return true if this <code>AccessDecisionVoter</code> can support the passed configuration attribute
|
|
|
+ * @return true if this {@code AccessDecisionVoter} can support the passed configuration attribute
|
|
|
*/
|
|
|
boolean supports(ConfigAttribute attribute);
|
|
|
|
|
|
/**
|
|
|
- * Indicates whether the <code>AccessDecisionVoter</code> implementation is able to provide access control
|
|
|
+ * Indicates whether the {@code AccessDecisionVoter} implementation is able to provide access control
|
|
|
* votes for the indicated secured object type.
|
|
|
*
|
|
|
* @param clazz the class that is being queried
|
|
@@ -65,26 +63,27 @@ public interface AccessDecisionVoter {
|
|
|
|
|
|
/**
|
|
|
* Indicates whether or not access is granted.
|
|
|
- * <p>The decision must be affirmative (<code>ACCESS_GRANTED</code>), negative (<code>ACCESS_DENIED</code>)
|
|
|
- * or the <code>AccessDecisionVoter</code> can abstain (<code>ACCESS_ABSTAIN</code>) from voting.
|
|
|
+ * <p>
|
|
|
+ * The decision must be affirmative ({@code ACCESS_GRANTED}), negative ({@code ACCESS_DENIED})
|
|
|
+ * or the {@code AccessDecisionVoter} can abstain ({@code ACCESS_ABSTAIN}) from voting.
|
|
|
* Under no circumstances should implementing classes return any other value. If a weighting of results is desired,
|
|
|
* this should be handled in a custom {@link org.springframework.security.access.AccessDecisionManager} instead.
|
|
|
- * </p>
|
|
|
- * <p>Unless an <code>AccessDecisionVoter</code> is specifically intended to vote on an access control
|
|
|
+ * <p>
|
|
|
+ * Unless an {@code AccessDecisionVoter} is specifically intended to vote on an access control
|
|
|
* decision due to a passed method invocation or configuration attribute parameter, it must return
|
|
|
- * <code>ACCESS_ABSTAIN</code>. This prevents the coordinating <code>AccessDecisionManager</code> from counting
|
|
|
- * votes from those <code>AccessDecisionVoter</code>s without a legitimate interest in the access control
|
|
|
+ * {@code ACCESS_ABSTAIN}. This prevents the coordinating {@code AccessDecisionManager} from counting
|
|
|
+ * votes from those {@code AccessDecisionVoter}s without a legitimate interest in the access control
|
|
|
* decision.
|
|
|
- * </p>
|
|
|
- * <p>Whilst the method invocation is passed as a parameter to maximise flexibility in making access
|
|
|
- * control decisions, implementing classes must never modify the behaviour of the method invocation (such as
|
|
|
- * calling <Code>MethodInvocation.proceed()</code>).</p>
|
|
|
+ * <p>
|
|
|
+ * Whilst the secured object (such as a {@code MethodInvocation}) is passed as a parameter to maximise flexibility
|
|
|
+ * in making access control decisions, implementing classes should not modify it or cause the represented invocation
|
|
|
+ * to take place (for example, by calling {@code MethodInvocation.proceed()}).
|
|
|
*
|
|
|
- * @param authentication the caller invoking the method
|
|
|
- * @param object the secured object
|
|
|
- * @param attributes the configuration attributes associated with the method being invoked
|
|
|
+ * @param authentication the caller making the invocation
|
|
|
+ * @param object the secured object being invoked
|
|
|
+ * @param attributes the configuration attributes associated with the secured object
|
|
|
*
|
|
|
* @return either {@link #ACCESS_GRANTED}, {@link #ACCESS_ABSTAIN} or {@link #ACCESS_DENIED}
|
|
|
*/
|
|
|
- int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes);
|
|
|
+ int vote(Authentication authentication, S object, Collection<ConfigAttribute> attributes);
|
|
|
}
|