Source Code Cross Referenced for Acl.java in  » 6.0-JDK-Core » security » java » security » acl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » security » java.security.acl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1996-2004 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package java.security.acl;
027
028        import java.util.Enumeration;
029        import java.security.Principal;
030
031        /**
032         * Interface representing an Access Control List (ACL).  An Access
033         * Control List is a data structure used to guard access to
034         * resources.<p>
035         *
036         * An ACL can be thought of as a data structure with multiple ACL
037         * entries.  Each ACL entry, of interface type AclEntry, contains a
038         * set of permissions associated with a particular principal. (A
039         * principal represents an entity such as an individual user or a
040         * group). Additionally, each ACL entry is specified as being either
041         * positive or negative. If positive, the permissions are to be
042         * granted to the associated principal. If negative, the permissions
043         * are to be denied.<p>
044         *
045         * The ACL Entries in each ACL observe the following rules:<p>
046         *
047         * <ul> <li>Each principal can have at most one positive ACL entry and
048         * one negative entry; that is, multiple positive or negative ACL
049         * entries are not allowed for any principal.  Each entry specifies
050         * the set of permissions that are to be granted (if positive) or
051         * denied (if negative). <p>
052         * 
053         * <li>If there is no entry for a particular principal, then the
054         * principal is considered to have a null (empty) permission set.<p>
055         *
056         * <li>If there is a positive entry that grants a principal a
057         * particular permission, and a negative entry that denies the
058         * principal the same permission, the result is as though the
059         * permission was never granted or denied. <p>
060         *
061         * <li>Individual permissions always override permissions of the
062         * group(s) to which the individual belongs. That is, individual
063         * negative permissions (specific denial of permissions) override the
064         * groups' positive permissions. And individual positive permissions
065         * override the groups' negative permissions.<p>
066         *
067         * </ul>
068         *
069         * The <code> java.security.acl </code> package provides the
070         * interfaces to the ACL and related data structures (ACL entries,
071         * groups, permissions, etc.), and the <code> sun.security.acl </code>
072         * classes provide a default implementation of the interfaces. For
073         * example, <code> java.security.acl.Acl </code> provides the
074         * interface to an ACL and the <code> sun.security.acl.AclImpl </code>
075         * class provides the default implementation of the interface.<p>
076         * 
077         * The <code> java.security.acl.Acl </code> interface extends the
078         * <code> java.security.acl.Owner </code> interface. The Owner
079         * interface is used to maintain a list of owners for each ACL.  Only
080         * owners are allowed to modify an ACL. For example, only an owner can
081         * call the ACL's <code>addEntry</code> method to add a new ACL entry 
082         * to the ACL.
083         * 
084         * @see java.security.acl.AclEntry
085         * @see java.security.acl.Owner
086         * @see java.security.acl.Acl#getPermissions
087         * 
088         * @version 1.30, 07/05/05
089         * @author Satish Dharmaraj 
090         */
091
092        public interface Acl extends Owner {
093
094            /**
095             * Sets the name of this ACL.
096             *
097             * @param caller the principal invoking this method. It must be an
098             * owner of this ACL.
099             *
100             * @param name the name to be given to this ACL.
101             *
102             * @exception NotOwnerException if the caller principal
103             * is not an owner of this ACL.  
104             *
105             * @see #getName
106             */
107            public void setName(Principal caller, String name)
108                    throws NotOwnerException;
109
110            /**
111             * Returns the name of this ACL. 
112             *
113             * @return the name of this ACL.
114             *
115             * @see #setName
116             */
117            public String getName();
118
119            /**
120             * Adds an ACL entry to this ACL. An entry associates a principal
121             * (e.g., an individual or a group) with a set of
122             * permissions. Each principal can have at most one positive ACL
123             * entry (specifying permissions to be granted to the principal)
124             * and one negative ACL entry (specifying permissions to be
125             * denied). If there is already an ACL entry of the same type
126             * (negative or positive) already in the ACL, false is returned.
127             * 
128             * @param caller the principal invoking this method. It must be an
129             * owner of this ACL.
130             *
131             * @param entry the ACL entry to be added to this ACL.
132             *
133             * @return true on success, false if an entry of the same type
134             * (positive or negative) for the same principal is already
135             * present in this ACL.
136             *
137             * @exception NotOwnerException if the caller principal
138             *  is not an owner of this ACL.  
139             */
140            public boolean addEntry(Principal caller, AclEntry entry)
141                    throws NotOwnerException;
142
143            /**
144             * Removes an ACL entry from this ACL.
145             * 
146             * @param caller the principal invoking this method. It must be an
147             * owner of this ACL.
148             *  
149             * @param entry the ACL entry to be removed from this ACL.
150             * 
151             * @return true on success, false if the entry is not part of this ACL.
152             * 
153             * @exception NotOwnerException if the caller principal is not
154             * an owner of this Acl.
155             */
156            public boolean removeEntry(Principal caller, AclEntry entry)
157                    throws NotOwnerException;
158
159            /**
160             * Returns an enumeration for the set of allowed permissions for the 
161             * specified principal (representing an entity such as an individual or 
162             * a group). This set of allowed permissions is calculated as
163             * follows:<p>
164             *
165             * <ul>
166             *  
167             * <li>If there is no entry in this Access Control List for the 
168             * specified principal, an empty permission set is returned.<p>
169             * 
170             * <li>Otherwise, the principal's group permission sets are determined.
171             * (A principal can belong to one or more groups, where a group is a 
172             * group of principals, represented by the Group interface.)
173             * The group positive permission set is the union of all 
174             * the positive permissions of each group that the principal belongs to.
175             * The group negative permission set is the union of all 
176             * the negative permissions of each group that the principal belongs to.
177             * If there is a specific permission that occurs in both 
178             * the positive permission set and the negative permission set, 
179             * it is removed from both.<p>
180             *
181             * The individual positive and negative permission sets are also 
182             * determined. The positive permission set contains the permissions 
183             * specified in the positive ACL entry (if any) for the principal. 
184             * Similarly, the negative permission set contains the permissions
185             * specified in the negative ACL entry (if any) for the principal. 
186             * The individual positive (or negative) permission set is considered 
187             * to be null if there is not a positive (negative) ACL entry for the
188             * principal in this ACL.<p>
189             *
190             * The set of permissions granted to the principal is then calculated 
191             * using the simple rule that individual permissions always override 
192             * the group permissions. That is, the principal's individual negative
193             * permission set (specific denial of permissions) overrides the group 
194             * positive permission set, and the principal's individual positive 
195             * permission set overrides the group negative permission set. 
196             * 
197             * </ul>
198             *
199             * @param user the principal whose permission set is to be returned.
200             * 
201             * @return the permission set specifying the permissions the principal 
202             * is allowed. 
203             */
204            public Enumeration<Permission> getPermissions(Principal user);
205
206            /**
207             * Returns an enumeration of the entries in this ACL. Each element in 
208             * the enumeration is of type AclEntry.
209             * 
210             * @return an enumeration of the entries in this ACL.
211             */
212            public Enumeration<AclEntry> entries();
213
214            /**
215             * Checks whether or not the specified principal has the specified 
216             * permission. If it does, true is returned, otherwise false is returned.
217             * 
218             * More specifically, this method checks whether the passed permission
219             * is a member of the allowed permission set of the specified principal.
220             * The allowed permission set is determined by the same algorithm as is 
221             * used by the <code>getPermissions</code> method.
222             * 
223             * @param principal the principal, assumed to be a valid authenticated 
224             * Principal.
225             * 
226             * @param permission the permission to be checked for.
227             * 
228             * @return true if the principal has the specified permission, false 
229             * otherwise.
230             * 
231             * @see #getPermissions
232             */
233            public boolean checkPermission(Principal principal,
234                    Permission permission);
235
236            /**
237             * Returns a string representation of the 
238             * ACL contents.
239             * 
240             * @return a string representation of the ACL contents.
241             */
242            public String toString();
243        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.