Showing the changes to java/pkg/java/security/acl (18 of 18352 files). Show all
Unified · Split
Binary file not shown.
| @@ -0,0 +1,241 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +import java.util.Enumeration; | |
| 29 | +import java.security.Principal; | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * Interface representing an Access Control List (ACL). An Access | |
| 33 | + * Control List is a data structure used to guard access to | |
| 34 | + * resources.<p> | |
| 35 | + * | |
| 36 | + * An ACL can be thought of as a data structure with multiple ACL | |
| 37 | + * entries. Each ACL entry, of interface type AclEntry, contains a | |
| 38 | + * set of permissions associated with a particular principal. (A | |
| 39 | + * principal represents an entity such as an individual user or a | |
| 40 | + * group). Additionally, each ACL entry is specified as being either | |
| 41 | + * positive or negative. If positive, the permissions are to be | |
| 42 | + * granted to the associated principal. If negative, the permissions | |
| 43 | + * are to be denied.<p> | |
| 44 | + * | |
| 45 | + * The ACL Entries in each ACL observe the following rules:<p> | |
| 46 | + * | |
| 47 | + * <ul> <li>Each principal can have at most one positive ACL entry and | |
| 48 | + * one negative entry; that is, multiple positive or negative ACL | |
| 49 | + * entries are not allowed for any principal. Each entry specifies | |
| 50 | + * the set of permissions that are to be granted (if positive) or | |
| 51 | + * denied (if negative). <p> | |
| 52 | + * | |
| 53 | + * <li>If there is no entry for a particular principal, then the | |
| 54 | + * principal is considered to have a null (empty) permission set.<p> | |
| 55 | + * | |
| 56 | + * <li>If there is a positive entry that grants a principal a | |
| 57 | + * particular permission, and a negative entry that denies the | |
| 58 | + * principal the same permission, the result is as though the | |
| 59 | + * permission was never granted or denied. <p> | |
| 60 | + * | |
| 61 | + * <li>Individual permissions always override permissions of the | |
| 62 | + * group(s) to which the individual belongs. That is, individual | |
| 63 | + * negative permissions (specific denial of permissions) override the | |
| 64 | + * groups' positive permissions. And individual positive permissions | |
| 65 | + * override the groups' negative permissions.<p> | |
| 66 | + * | |
| 67 | + * </ul> | |
| 68 | + * | |
| 69 | + * The <code> java.security.acl </code> package provides the | |
| 70 | + * interfaces to the ACL and related data structures (ACL entries, | |
| 71 | + * groups, permissions, etc.), and the <code> sun.security.acl </code> | |
| 72 | + * classes provide a default implementation of the interfaces. For | |
| 73 | + * example, <code> java.security.acl.Acl </code> provides the | |
| 74 | + * interface to an ACL and the <code> sun.security.acl.AclImpl </code> | |
| 75 | + * class provides the default implementation of the interface.<p> | |
| 76 | + * | |
| 77 | + * The <code> java.security.acl.Acl </code> interface extends the | |
| 78 | + * <code> java.security.acl.Owner </code> interface. The Owner | |
| 79 | + * interface is used to maintain a list of owners for each ACL. Only | |
| 80 | + * owners are allowed to modify an ACL. For example, only an owner can | |
| 81 | + * call the ACL's <code>addEntry</code> method to add a new ACL entry | |
| 82 | + * to the ACL. | |
| 83 | + * | |
| 84 | + * @see java.security.acl.AclEntry | |
| 85 | + * @see java.security.acl.Owner | |
| 86 | + * @see java.security.acl.Acl#getPermissions | |
| 87 | + * | |
| 88 | + * @author Satish Dharmaraj | |
| 89 | + */ | |
| 90 | + | |
| 91 | +public interface Acl extends Owner { | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Sets the name of this ACL. | |
| 95 | + * | |
| 96 | + * @param caller the principal invoking this method. It must be an | |
| 97 | + * owner of this ACL. | |
| 98 | + * | |
| 99 | + * @param name the name to be given to this ACL. | |
| 100 | + * | |
| 101 | + * @exception NotOwnerException if the caller principal | |
| 102 | + * is not an owner of this ACL. | |
| 103 | + * | |
| 104 | + * @see #getName | |
| 105 | + */ | |
| 106 | + public void setName(Principal caller, String name) | |
| 107 | + throws NotOwnerException; | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Returns the name of this ACL. | |
| 111 | + * | |
| 112 | + * @return the name of this ACL. | |
| 113 | + * | |
| 114 | + * @see #setName | |
| 115 | + */ | |
| 116 | + public String getName(); | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * Adds an ACL entry to this ACL. An entry associates a principal | |
| 120 | + * (e.g., an individual or a group) with a set of | |
| 121 | + * permissions. Each principal can have at most one positive ACL | |
| 122 | + * entry (specifying permissions to be granted to the principal) | |
| 123 | + * and one negative ACL entry (specifying permissions to be | |
| 124 | + * denied). If there is already an ACL entry of the same type | |
| 125 | + * (negative or positive) already in the ACL, false is returned. | |
| 126 | + * | |
| 127 | + * @param caller the principal invoking this method. It must be an | |
| 128 | + * owner of this ACL. | |
| 129 | + * | |
| 130 | + * @param entry the ACL entry to be added to this ACL. | |
| 131 | + * | |
| 132 | + * @return true on success, false if an entry of the same type | |
| 133 | + * (positive or negative) for the same principal is already | |
| 134 | + * present in this ACL. | |
| 135 | + * | |
| 136 | + * @exception NotOwnerException if the caller principal | |
| 137 | + * is not an owner of this ACL. | |
| 138 | + */ | |
| 139 | + public boolean addEntry(Principal caller, AclEntry entry) | |
| 140 | + throws NotOwnerException; | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * Removes an ACL entry from this ACL. | |
| 144 | + * | |
| 145 | + * @param caller the principal invoking this method. It must be an | |
| 146 | + * owner of this ACL. | |
| 147 | + * | |
| 148 | + * @param entry the ACL entry to be removed from this ACL. | |
| 149 | + * | |
| 150 | + * @return true on success, false if the entry is not part of this ACL. | |
| 151 | + * | |
| 152 | + * @exception NotOwnerException if the caller principal is not | |
| 153 | + * an owner of this Acl. | |
| 154 | + */ | |
| 155 | + public boolean removeEntry(Principal caller, AclEntry entry) | |
| 156 | + throws NotOwnerException; | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * Returns an enumeration for the set of allowed permissions for the | |
| 160 | + * specified principal (representing an entity such as an individual or | |
| 161 | + * a group). This set of allowed permissions is calculated as | |
| 162 | + * follows:<p> | |
| 163 | + * | |
| 164 | + * <ul> | |
| 165 | + * | |
| 166 | + * <li>If there is no entry in this Access Control List for the | |
| 167 | + * specified principal, an empty permission set is returned.<p> | |
| 168 | + * | |
| 169 | + * <li>Otherwise, the principal's group permission sets are determined. | |
| 170 | + * (A principal can belong to one or more groups, where a group is a | |
| 171 | + * group of principals, represented by the Group interface.) | |
| 172 | + * The group positive permission set is the union of all | |
| 173 | + * the positive permissions of each group that the principal belongs to. | |
| 174 | + * The group negative permission set is the union of all | |
| 175 | + * the negative permissions of each group that the principal belongs to. | |
| 176 | + * If there is a specific permission that occurs in both | |
| 177 | + * the positive permission set and the negative permission set, | |
| 178 | + * it is removed from both.<p> | |
| 179 | + * | |
| 180 | + * The individual positive and negative permission sets are also | |
| 181 | + * determined. The positive permission set contains the permissions | |
| 182 | + * specified in the positive ACL entry (if any) for the principal. | |
| 183 | + * Similarly, the negative permission set contains the permissions | |
| 184 | + * specified in the negative ACL entry (if any) for the principal. | |
| 185 | + * The individual positive (or negative) permission set is considered | |
| 186 | + * to be null if there is not a positive (negative) ACL entry for the | |
| 187 | + * principal in this ACL.<p> | |
| 188 | + * | |
| 189 | + * The set of permissions granted to the principal is then calculated | |
| 190 | + * using the simple rule that individual permissions always override | |
| 191 | + * the group permissions. That is, the principal's individual negative | |
| 192 | + * permission set (specific denial of permissions) overrides the group | |
| 193 | + * positive permission set, and the principal's individual positive | |
| 194 | + * permission set overrides the group negative permission set. | |
| 195 | + * | |
| 196 | + * </ul> | |
| 197 | + * | |
| 198 | + * @param user the principal whose permission set is to be returned. | |
| 199 | + * | |
| 200 | + * @return the permission set specifying the permissions the principal | |
| 201 | + * is allowed. | |
| 202 | + */ | |
| 203 | + public Enumeration<Permission> getPermissions(Principal user); | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * Returns an enumeration of the entries in this ACL. Each element in | |
| 207 | + * the enumeration is of type AclEntry. | |
| 208 | + * | |
| 209 | + * @return an enumeration of the entries in this ACL. | |
| 210 | + */ | |
| 211 | + public Enumeration<AclEntry> entries(); | |
| 212 | + | |
| 213 | + /** | |
| 214 | + * Checks whether or not the specified principal has the specified | |
| 215 | + * permission. If it does, true is returned, otherwise false is returned. | |
| 216 | + * | |
| 217 | + * More specifically, this method checks whether the passed permission | |
| 218 | + * is a member of the allowed permission set of the specified principal. | |
| 219 | + * The allowed permission set is determined by the same algorithm as is | |
| 220 | + * used by the <code>getPermissions</code> method. | |
| 221 | + * | |
| 222 | + * @param principal the principal, assumed to be a valid authenticated | |
| 223 | + * Principal. | |
| 224 | + * | |
| 225 | + * @param permission the permission to be checked for. | |
| 226 | + * | |
| 227 | + * @return true if the principal has the specified permission, false | |
| 228 | + * otherwise. | |
| 229 | + * | |
| 230 | + * @see #getPermissions | |
| 231 | + */ | |
| 232 | + public boolean checkPermission(Principal principal, Permission permission); | |
| 233 | + | |
| 234 | + /** | |
| 235 | + * Returns a string representation of the | |
| 236 | + * ACL contents. | |
| 237 | + * | |
| 238 | + * @return a string representation of the ACL contents. | |
| 239 | + */ | |
| 240 | + public String toString(); | |
| 241 | +} | |
Binary file not shown.
| @@ -0,0 +1,154 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +import java.util.Enumeration; | |
| 29 | +import java.security.Principal; | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * This is the interface used for representing one entry in an Access | |
| 33 | + * Control List (ACL).<p> | |
| 34 | + * | |
| 35 | + * An ACL can be thought of as a data structure with multiple ACL entry | |
| 36 | + * objects. Each ACL entry object contains a set of permissions associated | |
| 37 | + * with a particular principal. (A principal represents an entity such as | |
| 38 | + * an individual user or a group). Additionally, each ACL entry is specified | |
| 39 | + * as being either positive or negative. If positive, the permissions are | |
| 40 | + * to be granted to the associated principal. If negative, the permissions | |
| 41 | + * are to be denied. Each principal can have at most one positive ACL entry | |
| 42 | + * and one negative entry; that is, multiple positive or negative ACL | |
| 43 | + * entries are not allowed for any principal. | |
| 44 | + * | |
| 45 | + * Note: ACL entries are by default positive. An entry becomes a | |
| 46 | + * negative entry only if the | |
| 47 | + * {@link #setNegativePermissions() setNegativePermissions} | |
| 48 | + * method is called on it. | |
| 49 | + * | |
| 50 | + * @see java.security.acl.Acl | |
| 51 | + * | |
| 52 | + * @author Satish Dharmaraj | |
| 53 | + */ | |
| 54 | +public interface AclEntry extends Cloneable { | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * Specifies the principal for which permissions are granted or denied | |
| 58 | + * by this ACL entry. If a principal was already set for this ACL entry, | |
| 59 | + * false is returned, otherwise true is returned. | |
| 60 | + * | |
| 61 | + * @param user the principal to be set for this entry. | |
| 62 | + * | |
| 63 | + * @return true if the principal is set, false if there was | |
| 64 | + * already a principal set for this entry. | |
| 65 | + * | |
| 66 | + * @see #getPrincipal | |
| 67 | + */ | |
| 68 | + public boolean setPrincipal(Principal user); | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Returns the principal for which permissions are granted or denied by | |
| 72 | + * this ACL entry. Returns null if there is no principal set for this | |
| 73 | + * entry yet. | |
| 74 | + * | |
| 75 | + * @return the principal associated with this entry. | |
| 76 | + * | |
| 77 | + * @see #setPrincipal | |
| 78 | + */ | |
| 79 | + public Principal getPrincipal(); | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * Sets this ACL entry to be a negative one. That is, the associated | |
| 83 | + * principal (e.g., a user or a group) will be denied the permission set | |
| 84 | + * specified in the entry. | |
| 85 | + * | |
| 86 | + * Note: ACL entries are by default positive. An entry becomes a | |
| 87 | + * negative entry only if this <code>setNegativePermissions</code> | |
| 88 | + * method is called on it. | |
| 89 | + */ | |
| 90 | + public void setNegativePermissions(); | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * Returns true if this is a negative ACL entry (one denying the | |
| 94 | + * associated principal the set of permissions in the entry), false | |
| 95 | + * otherwise. | |
| 96 | + * | |
| 97 | + * @return true if this is a negative ACL entry, false if it's not. | |
| 98 | + */ | |
| 99 | + public boolean isNegative(); | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Adds the specified permission to this ACL entry. Note: An entry can | |
| 103 | + * have multiple permissions. | |
| 104 | + * | |
| 105 | + * @param permission the permission to be associated with | |
| 106 | + * the principal in this entry. | |
| 107 | + * | |
| 108 | + * @return true if the permission was added, false if the | |
| 109 | + * permission was already part of this entry's permission set. | |
| 110 | + */ | |
| 111 | + public boolean addPermission(Permission permission); | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * Removes the specified permission from this ACL entry. | |
| 115 | + * | |
| 116 | + * @param permission the permission to be removed from this entry. | |
| 117 | + * | |
| 118 | + * @return true if the permission is removed, false if the | |
| 119 | + * permission was not part of this entry's permission set. | |
| 120 | + */ | |
| 121 | + public boolean removePermission(Permission permission); | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * Checks if the specified permission is part of the | |
| 125 | + * permission set in this entry. | |
| 126 | + * | |
| 127 | + * @param permission the permission to be checked for. | |
| 128 | + * | |
| 129 | + * @return true if the permission is part of the | |
| 130 | + * permission set in this entry, false otherwise. | |
| 131 | + */ | |
| 132 | + public boolean checkPermission(Permission permission); | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * Returns an enumeration of the permissions in this ACL entry. | |
| 136 | + * | |
| 137 | + * @return an enumeration of the permissions in this ACL entry. | |
| 138 | + */ | |
| 139 | + public Enumeration<Permission> permissions(); | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * Returns a string representation of the contents of this ACL entry. | |
| 143 | + * | |
| 144 | + * @return a string representation of the contents. | |
| 145 | + */ | |
| 146 | + public String toString(); | |
| 147 | + | |
| 148 | + /** | |
| 149 | + * Clones this ACL entry. | |
| 150 | + * | |
| 151 | + * @return a clone of this ACL entry. | |
| 152 | + */ | |
| 153 | + public Object clone(); | |
| 154 | +} | |
Binary file not shown.
| @@ -0,0 +1,44 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * This is an exception that is thrown whenever a reference is made to a | |
| 30 | + * non-existent ACL (Access Control List). | |
| 31 | + * | |
| 32 | + * @author Satish Dharmaraj | |
| 33 | + */ | |
| 34 | +public class AclNotFoundException extends Exception { | |
| 35 | + | |
| 36 | + private static final long serialVersionUID = 5684295034092681791L; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * Constructs an AclNotFoundException. | |
| 40 | + */ | |
| 41 | + public AclNotFoundException() { | |
| 42 | + } | |
| 43 | + | |
| 44 | +} | |
Binary file not shown.
| @@ -0,0 +1,87 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +import java.util.Enumeration; | |
| 29 | +import java.security.Principal; | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * This interface is used to represent a group of principals. (A principal | |
| 33 | + * represents an entity such as an individual user or a company). <p> | |
| 34 | + * | |
| 35 | + * Note that Group extends Principal. Thus, either a Principal or a Group can | |
| 36 | + * be passed as an argument to methods containing a Principal parameter. For | |
| 37 | + * example, you can add either a Principal or a Group to a Group object by | |
| 38 | + * calling the object's <code>addMember</code> method, passing it the | |
| 39 | + * Principal or Group. | |
| 40 | + * | |
| 41 | + * @author Satish Dharmaraj | |
| 42 | + */ | |
| 43 | +public interface Group extends Principal { | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Adds the specified member to the group. | |
| 47 | + * | |
| 48 | + * @param user the principal to add to this group. | |
| 49 | + * | |
| 50 | + * @return true if the member was successfully added, | |
| 51 | + * false if the principal was already a member. | |
| 52 | + */ | |
| 53 | + public boolean addMember(Principal user); | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Removes the specified member from the group. | |
| 57 | + * | |
| 58 | + * @param user the principal to remove from this group. | |
| 59 | + * | |
| 60 | + * @return true if the principal was removed, or | |
| 61 | + * false if the principal was not a member. | |
| 62 | + */ | |
| 63 | + public boolean removeMember(Principal user); | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * Returns true if the passed principal is a member of the group. | |
| 67 | + * This method does a recursive search, so if a principal belongs to a | |
| 68 | + * group which is a member of this group, true is returned. | |
| 69 | + * | |
| 70 | + * @param member the principal whose membership is to be checked. | |
| 71 | + * | |
| 72 | + * @return true if the principal is a member of this group, | |
| 73 | + * false otherwise. | |
| 74 | + */ | |
| 75 | + public boolean isMember(Principal member); | |
| 76 | + | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Returns an enumeration of the members in the group. | |
| 80 | + * The returned objects can be instances of either Principal | |
| 81 | + * or Group (which is a subclass of Principal). | |
| 82 | + * | |
| 83 | + * @return an enumeration of the group members. | |
| 84 | + */ | |
| 85 | + public Enumeration<? extends Principal> members(); | |
| 86 | + | |
| 87 | +} | |
Binary file not shown.
| @@ -0,0 +1,45 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * This is an exception that is thrown whenever an attempt is made to delete | |
| 30 | + * the last owner of an Access Control List. | |
| 31 | + * | |
| 32 | + * @see java.security.acl.Owner#deleteOwner | |
| 33 | + * | |
| 34 | + * @author Satish Dharmaraj | |
| 35 | + */ | |
| 36 | +public class LastOwnerException extends Exception { | |
| 37 | + | |
| 38 | + private static final long serialVersionUID = -5141997548211140359L; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * Constructs a LastOwnerException. | |
| 42 | + */ | |
| 43 | + public LastOwnerException() { | |
| 44 | + } | |
| 45 | +} | |
Binary file not shown.
| @@ -0,0 +1,44 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * This is an exception that is thrown whenever the modification of an object | |
| 30 | + * (such as an Access Control List) is only allowed to be done by an owner of | |
| 31 | + * the object, but the Principal attempting the modification is not an owner. | |
| 32 | + * | |
| 33 | + * @author Satish Dharmaraj | |
| 34 | + */ | |
| 35 | +public class NotOwnerException extends Exception { | |
| 36 | + | |
| 37 | + private static final long serialVersionUID = -5555597911163362399L; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * Constructs a NotOwnerException. | |
| 41 | + */ | |
| 42 | + public NotOwnerException() { | |
| 43 | + } | |
| 44 | +} | |
Binary file not shown.
| @@ -0,0 +1,95 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | +import java.security.Principal; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Interface for managing owners of Access Control Lists (ACLs) or ACL | |
| 32 | + * configurations. (Note that the Acl interface in the | |
| 33 | + * <code> java.security.acl </code> package extends this Owner | |
| 34 | + * interface.) The initial owner Principal should be specified as an | |
| 35 | + * argument to the constructor of the class implementing this interface. | |
| 36 | + * | |
| 37 | + * @see java.security.acl.Acl | |
| 38 | + * | |
| 39 | + */ | |
| 40 | +public interface Owner { | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Adds an owner. Only owners can modify ACL contents. The caller | |
| 44 | + * principal must be an owner of the ACL in order to invoke this method. | |
| 45 | + * That is, only an owner can add another owner. The initial owner is | |
| 46 | + * configured at ACL construction time. | |
| 47 | + * | |
| 48 | + * @param caller the principal invoking this method. It must be an owner | |
| 49 | + * of the ACL. | |
| 50 | + * | |
| 51 | + * @param owner the owner that should be added to the list of owners. | |
| 52 | + * | |
| 53 | + * @return true if successful, false if owner is already an owner. | |
| 54 | + * @exception NotOwnerException if the caller principal is not an owner | |
| 55 | + * of the ACL. | |
| 56 | + */ | |
| 57 | + public boolean addOwner(Principal caller, Principal owner) | |
| 58 | + throws NotOwnerException; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Deletes an owner. If this is the last owner in the ACL, an exception is | |
| 62 | + * raised.<p> | |
| 63 | + * | |
| 64 | + * The caller principal must be an owner of the ACL in order to invoke | |
| 65 | + * this method. | |
| 66 | + * | |
| 67 | + * @param caller the principal invoking this method. It must be an owner | |
| 68 | + * of the ACL. | |
| 69 | + * | |
| 70 | + * @param owner the owner to be removed from the list of owners. | |
| 71 | + * | |
| 72 | + * @return true if the owner is removed, false if the owner is not part | |
| 73 | + * of the list of owners. | |
| 74 | + * | |
| 75 | + * @exception NotOwnerException if the caller principal is not an owner | |
| 76 | + * of the ACL. | |
| 77 | + * | |
| 78 | + * @exception LastOwnerException if there is only one owner left, so that | |
| 79 | + * deleteOwner would leave the ACL owner-less. | |
| 80 | + */ | |
| 81 | + public boolean deleteOwner(Principal caller, Principal owner) | |
| 82 | + throws NotOwnerException, LastOwnerException; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Returns true if the given principal is an owner of the ACL. | |
| 86 | + * | |
| 87 | + * @param owner the principal to be checked to determine whether or not | |
| 88 | + * it is an owner. | |
| 89 | + * | |
| 90 | + * @return true if the passed principal is in the list of owners, false | |
| 91 | + * if not. | |
| 92 | + */ | |
| 93 | + public boolean isOwner(Principal owner); | |
| 94 | + | |
| 95 | +} | |
Binary file not shown.
| @@ -0,0 +1,54 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package java.security.acl; | |
| 27 | + | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * This interface represents a permission, such as that used to grant | |
| 31 | + * a particular type of access to a resource. | |
| 32 | + * | |
| 33 | + * @author Satish Dharmaraj | |
| 34 | + */ | |
| 35 | +public interface Permission { | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Returns true if the object passed matches the permission represented | |
| 39 | + * in this interface. | |
| 40 | + * | |
| 41 | + * @param another the Permission object to compare with. | |
| 42 | + * | |
| 43 | + * @return true if the Permission objects are equal, false otherwise | |
| 44 | + */ | |
| 45 | + public boolean equals(Object another); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Prints a string representation of this permission. | |
| 49 | + * | |
| 50 | + * @return the string representation of the permission. | |
| 51 | + */ | |
| 52 | + public String toString(); | |
| 53 | + | |
| 54 | +} | |
| @@ -0,0 +1,15 @@ | ||
| 1 | +<../../../../../mkconfig | |
| 2 | + | |
| 3 | +TARG=\ | |
| 4 | + Acl.dis\ | |
| 5 | + AclEntry.dis\ | |
| 6 | + AclNotFoundException.dis\ | |
| 7 | + Group.dis\ | |
| 8 | + LastOwnerException.dis\ | |
| 9 | + NotOwnerException.dis\ | |
| 10 | + Owner.dis\ | |
| 11 | + Permission.dis\ | |
| 12 | + | |
| 13 | +DISBIN=$ROOT/java/dis/java/java/java/security/acl | |
| 14 | + | |
| 15 | +<$ROOT/mkfiles/mkjava | |
| @@ -0,0 +1,54 @@ | ||
| 1 | +<DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> | |
| 2 | +<html> | |
| 3 | +<head> | |
| 4 | +<!-- | |
| 5 | +Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. | |
| 6 | +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 7 | + | |
| 8 | +This code is free software; you can redistribute it and/or modify it | |
| 9 | +under the terms of the GNU General Public License version 2 only, as | |
| 10 | +published by the Free Software Foundation. Oracle designates this | |
| 11 | +particular file as subject to the "Classpath" exception as provided | |
| 12 | +by Oracle in the LICENSE file that accompanied this code. | |
| 13 | + | |
| 14 | +This code is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 16 | +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 17 | +version 2 for more details (a copy is included in the LICENSE file that | |
| 18 | +accompanied this code). | |
| 19 | + | |
| 20 | +You should have received a copy of the GNU General Public License version | |
| 21 | +2 along with this work; if not, write to the Free Software Foundation, | |
| 22 | +Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 23 | + | |
| 24 | +Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 25 | +or visit www.oracle.com if you need additional information or have any | |
| 26 | +questions. | |
| 27 | +--> | |
| 28 | + | |
| 29 | +</head> | |
| 30 | +<body bgcolor="white"> | |
| 31 | + | |
| 32 | +The classes and interfaces in this package have been | |
| 33 | +superseded by classes in the java.security package. | |
| 34 | +See that package and, for example, java.security.Permission for details. | |
| 35 | + | |
| 36 | +<!-- | |
| 37 | +<h2>Package Specification</h2> | |
| 38 | + | |
| 39 | +##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT ##### | |
| 40 | +<ul> | |
| 41 | + <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a> | |
| 42 | +</ul> | |
| 43 | + | |
| 44 | +<h2>Related Documentation</h2> | |
| 45 | + | |
| 46 | +For overviews, tutorials, examples, guides, and tool documentation, please see: | |
| 47 | +<ul> | |
| 48 | + <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a> | |
| 49 | +</ul> | |
| 50 | +--> | |
| 51 | + | |
| 52 | +@since JDK1.1 | |
| 53 | +</body> | |
| 54 | +</html> | |