View Javadoc

1   /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.acegisecurity;
17  
18  /**
19   * Makes a final access control (authorization) decision.
20   *
21   * @author Ben Alex
22   * @version $Id: AccessDecisionManager.java 1784 2007-02-24 21:00:24Z luke_t $
23   */
24  public interface AccessDecisionManager {
25      //~ Methods ========================================================================================================
26  
27      /**
28       * Resolves an access control decision for the passed parameters.
29       *
30       * @param authentication the caller invoking the method
31       * @param object the secured object being called
32       * @param config the configuration attributes associated with the secured object being invoked
33       *
34       * @throws AccessDeniedException if access is denied as the authentication does not hold a required authority or
35       *         ACL privilege
36       * @throws InsufficientAuthenticationException if access is denied as the authentication does not provide a
37       *         sufficient level of trust
38       */
39      void decide(Authentication authentication, Object object, ConfigAttributeDefinition config)
40          throws AccessDeniedException, InsufficientAuthenticationException;
41  
42      /**
43       * Indicates whether this <code>AccessDecisionManager</code> is able to process authorization requests
44       * presented with the passed <code>ConfigAttribute</code>.<p>This allows the
45       * <code>AbstractSecurityInterceptor</code> to check every configuration attribute can be consumed by the
46       * configured <code>AccessDecisionManager</code> and/or <code>RunAsManager</code> and/or
47       * <code>AfterInvocationManager</code>.</p>
48       *
49       * @param attribute a configuration attribute that has been configured against the
50       *        <code>AbstractSecurityInterceptor</code>
51       *
52       * @return true if this <code>AccessDecisionManager</code> can support the passed configuration attribute
53       */
54      boolean supports(ConfigAttribute attribute);
55  
56      /**
57       * Indicates whether the <code>AccessDecisionManager</code> implementation is able to provide access
58       * control decisions for the indicated secured object type.
59       *
60       * @param clazz the class that is being queried
61       *
62       * @return <code>true</code> if the implementation can process the indicated class
63       */
64      boolean supports(Class clazz);
65  }