View Javadoc

1   /* Copyright 2004 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.acl;
17  
18  import org.acegisecurity.Authentication;
19  
20  /***
21   * Indicates a class can process a given domain object instance and
22   * authoritatively return the ACLs that apply.
23   * 
24   * <P>
25   * Implementations are typically called from the {@link AclProviderManager}.
26   * </p>
27   *
28   * @author Ben Alex
29   * @version $Id: AclProvider.java,v 1.2 2005/11/17 00:55:51 benalex Exp $
30   */
31  public interface AclProvider {
32      //~ Methods ================================================================
33  
34      /***
35       * Obtains the ACLs that apply to the specified domain instance.
36       * 
37       * <P>
38       * Will never be called unless the {@link #supports(Object)} method
39       * returned <code>true</code>.
40       * </p>
41       *
42       * @param domainInstance the instance for which ACL information is required
43       *        (never <code>null</code>)
44       *
45       * @return the ACLs that apply, or <code>null</code> if no ACLs apply to
46       *         the specified domain instance
47       */
48      public AclEntry[] getAcls(Object domainInstance);
49  
50      /***
51       * Obtains the ACLs that apply to the specified domain instance
52       * and presented <code>Authentication</code> object.
53       *
54       * <P>
55       * Will never be called unless the {@link #supports(Object)} method
56       * returned <code>true</code>.
57       * </p>
58       * 
59       * @param domainInstance the instance for which ACL information is required
60       *        (never <code>null</code>)
61       * @param authentication the prncipal for which ACL information should be
62       *        filtered (never <code>null</code>)
63       *
64       * @return only those ACLs applying to the domain instance that have been
65       *         granted to the principal (or <code>null</code>) if no such ACLs
66       *         are found
67       */
68      public AclEntry[] getAcls(Object domainInstance,
69          Authentication authentication);
70  
71      /***
72       * Indicates whether this <code>AclProvider</code> can authoritatively
73       * return ACL information for the specified domain object instance.
74       *
75       * @param domainInstance the instance for which ACL information is required
76       *        (never <code>null</code>)
77       *
78       * @return <code>true</code> if this provider is authoritative for the
79       *         specified domain object instance, <code>false</code> otherwise
80       */
81      public boolean supports(Object domainInstance);
82  }