src/java.base/share/classes/java/security/acl/Acl.java
author mullan
Tue, 14 Nov 2017 09:15:12 -0500
changeset 47745 e6e6ed17abbe
parent 47216 71c04702a3d5
permissions -rw-r--r--
8175094: Mark the deprecated java.security.acl APIs with forRemoval=true Reviewed-by: weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
43541
9aeb1de77a63 8173827: Remove forRemoval=true from several deprecated security APIs
mullan
parents: 39334
diff changeset
     2
 * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.security.acl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.security.Principal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Interface representing an Access Control List (ACL).  An Access
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * Control List is a data structure used to guard access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * resources.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * An ACL can be thought of as a data structure with multiple ACL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * entries.  Each ACL entry, of interface type AclEntry, contains a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * set of permissions associated with a particular principal. (A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * principal represents an entity such as an individual user or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * group). Additionally, each ACL entry is specified as being either
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * positive or negative. If positive, the permissions are to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * granted to the associated principal. If negative, the permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * are to be denied.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
    45
 * The ACL Entries in each ACL observe the following rules:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <ul> <li>Each principal can have at most one positive ACL entry and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * one negative entry; that is, multiple positive or negative ACL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * entries are not allowed for any principal.  Each entry specifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * the set of permissions that are to be granted (if positive) or
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
    51
 * denied (if negative).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <li>If there is no entry for a particular principal, then the
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
    54
 * principal is considered to have a null (empty) permission set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <li>If there is a positive entry that grants a principal a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * particular permission, and a negative entry that denies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * principal the same permission, the result is as though the
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
    59
 * permission was never granted or denied.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <li>Individual permissions always override permissions of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * group(s) to which the individual belongs. That is, individual
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * negative permissions (specific denial of permissions) override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * groups' positive permissions. And individual positive permissions
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
    65
 * override the groups' negative permissions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    69
 * The {@code  java.security.acl } package provides the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * interfaces to the ACL and related data structures (ACL entries,
29100
56267f38f743 8072663: Remove the sun.security.acl package which is not used in the JDK
juh
parents: 28773
diff changeset
    71
 * groups, permissions, etc.).<p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    73
 * The {@code  java.security.acl.Acl } interface extends the
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    74
 * {@code  java.security.acl.Owner } interface. The Owner
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * interface is used to maintain a list of owners for each ACL.  Only
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * owners are allowed to modify an ACL. For example, only an owner can
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
    77
 * call the ACL's {@code addEntry} method to add a new ACL entry
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * to the ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * @see java.security.acl.AclEntry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * @see java.security.acl.Owner
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * @see java.security.acl.Acl#getPermissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * @author Satish Dharmaraj
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 43541
diff changeset
    85
 * @since 1.1
29377
d3f457ce9c48 8073430: Deprecate security APIs that have been superseded
juh
parents: 29100
diff changeset
    86
 *
47745
e6e6ed17abbe 8175094: Mark the deprecated java.security.acl APIs with forRemoval=true
mullan
parents: 47216
diff changeset
    87
 * @deprecated This class is deprecated and subject to removal in a future
e6e6ed17abbe 8175094: Mark the deprecated java.security.acl APIs with forRemoval=true
mullan
parents: 47216
diff changeset
    88
 *     version of Java SE. It has been replaced by {@code java.security.Policy}
e6e6ed17abbe 8175094: Mark the deprecated java.security.acl APIs with forRemoval=true
mullan
parents: 47216
diff changeset
    89
 *     and related classes since 1.2.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
47745
e6e6ed17abbe 8175094: Mark the deprecated java.security.acl APIs with forRemoval=true
mullan
parents: 47216
diff changeset
    92
@Deprecated(since="9", forRemoval=true)
e6e6ed17abbe 8175094: Mark the deprecated java.security.acl APIs with forRemoval=true
mullan
parents: 47216
diff changeset
    93
@SuppressWarnings("removal")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
public interface Acl extends Owner {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * Sets the name of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @param caller the principal invoking this method. It must be an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * owner of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @param name the name to be given to this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @exception NotOwnerException if the caller principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * is not an owner of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @see #getName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public void setName(Principal caller, String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
      throws NotOwnerException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Returns the name of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @return the name of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @see #setName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public String getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Adds an ACL entry to this ACL. An entry associates a principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * (e.g., an individual or a group) with a set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * permissions. Each principal can have at most one positive ACL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * entry (specifying permissions to be granted to the principal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * and one negative ACL entry (specifying permissions to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * denied). If there is already an ACL entry of the same type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * (negative or positive) already in the ACL, false is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * @param caller the principal invoking this method. It must be an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * owner of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @param entry the ACL entry to be added to this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @return true on success, false if an entry of the same type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * (positive or negative) for the same principal is already
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * present in this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @exception NotOwnerException if the caller principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *  is not an owner of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    public boolean addEntry(Principal caller, AclEntry entry)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      throws NotOwnerException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * Removes an ACL entry from this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @param caller the principal invoking this method. It must be an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * owner of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @param entry the ACL entry to be removed from this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @return true on success, false if the entry is not part of this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @exception NotOwnerException if the caller principal is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * an owner of this Acl.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public boolean removeEntry(Principal caller, AclEntry entry)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
          throws NotOwnerException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Returns an enumeration for the set of allowed permissions for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * specified principal (representing an entity such as an individual or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * a group). This set of allowed permissions is calculated as
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
   165
     * follows:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * <li>If there is no entry in this Access Control List for the
21334
c60dfce46a77 8026982: javadoc errors in core libs
rriggs
parents: 18579
diff changeset
   170
     * specified principal, an empty permission set is returned.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * <li>Otherwise, the principal's group permission sets are determined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * (A principal can belong to one or more groups, where a group is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * group of principals, represented by the Group interface.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * The group positive permission set is the union of all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * the positive permissions of each group that the principal belongs to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * The group negative permission set is the union of all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * the negative permissions of each group that the principal belongs to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * If there is a specific permission that occurs in both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * the positive permission set and the negative permission set,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * it is removed from both.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * The individual positive and negative permission sets are also
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * determined. The positive permission set contains the permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * specified in the positive ACL entry (if any) for the principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Similarly, the negative permission set contains the permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * specified in the negative ACL entry (if any) for the principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * The individual positive (or negative) permission set is considered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * to be null if there is not a positive (negative) ACL entry for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * principal in this ACL.<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * The set of permissions granted to the principal is then calculated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * using the simple rule that individual permissions always override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * the group permissions. That is, the principal's individual negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * permission set (specific denial of permissions) overrides the group
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * positive permission set, and the principal's individual positive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * permission set overrides the group negative permission set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @param user the principal whose permission set is to be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @return the permission set specifying the permissions the principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * is allowed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public Enumeration<Permission> getPermissions(Principal user);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * Returns an enumeration of the entries in this ACL. Each element in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * the enumeration is of type AclEntry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @return an enumeration of the entries in this ACL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public Enumeration<AclEntry> entries();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * Checks whether or not the specified principal has the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * permission. If it does, true is returned, otherwise false is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * More specifically, this method checks whether the passed permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * is a member of the allowed permission set of the specified principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * The allowed permission set is determined by the same algorithm as is
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 5506
diff changeset
   223
     * used by the {@code getPermissions} method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @param principal the principal, assumed to be a valid authenticated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * Principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * @param permission the permission to be checked for.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * @return true if the principal has the specified permission, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @see #getPermissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    public boolean checkPermission(Principal principal, Permission permission);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * Returns a string representation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * ACL contents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @return a string representation of the ACL contents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    public String toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
}