java.security.acl
Interface Acl

All Superinterfaces:
Owner sample code for java.security.acl.Owner definition code for java.security.acl.Owner

public interface Acl
extends Owner sample code for java.security.acl.Owner definition code for java.security.acl.Owner

Interface representing an Access Control List (ACL). An Access Control List is a data structure used to guard access to resources.

An ACL can be thought of as a data structure with multiple ACL entries. Each ACL entry, of interface type AclEntry, contains a set of permissions associated with a particular principal. (A principal represents an entity such as an individual user or a group). Additionally, each ACL entry is specified as being either positive or negative. If positive, the permissions are to be granted to the associated principal. If negative, the permissions are to be denied.

The ACL Entries in each ACL observe the following rules:

The java.security.acl package provides the interfaces to the ACL and related data structures (ACL entries, groups, permissions, etc.), and the sun.security.acl classes provide a default implementation of the interfaces. For example, java.security.acl.Acl provides the interface to an ACL and the sun.security.acl.AclImpl class provides the default implementation of the interface.

The java.security.acl.Acl interface extends the java.security.acl.Owner interface. The Owner interface is used to maintain a list of owners for each ACL. Only owners are allowed to modify an ACL. For example, only an owner can call the ACL's addEntry method to add a new ACL entry to the ACL.

See Also:
AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry , Owner sample code for java.security.acl.Owner definition code for java.security.acl.Owner , getPermissions(java.security.Principal) sample code for java.security.acl.Acl.getPermissions(java.security.Principal) definition code for java.security.acl.Acl.getPermissions(java.security.Principal)

Method Summary
 boolean addEntry sample code for java.security.acl.Acl.addEntry(java.security.Principal, java.security.acl.AclEntry) definition code for java.security.acl.Acl.addEntry(java.security.Principal, java.security.acl.AclEntry) (Principal sample code for java.security.Principal definition code for java.security.Principal  caller, AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry  entry)
          Adds an ACL entry to this ACL.
 boolean checkPermission sample code for java.security.acl.Acl.checkPermission(java.security.Principal, java.security.acl.Permission) definition code for java.security.acl.Acl.checkPermission(java.security.Principal, java.security.acl.Permission) (Principal sample code for java.security.Principal definition code for java.security.Principal  principal, Permission sample code for java.security.acl.Permission definition code for java.security.acl.Permission  permission)
          Checks whether or not the specified principal has the specified permission.
 Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry > entries sample code for java.security.acl.Acl.entries() definition code for java.security.acl.Acl.entries() ()
          Returns an enumeration of the entries in this ACL.
 String sample code for java.lang.String definition code for java.lang.String getName sample code for java.security.acl.Acl.getName() definition code for java.security.acl.Acl.getName() ()
          Returns the name of this ACL.
 Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <Permission sample code for java.security.acl.Permission definition code for java.security.acl.Permission > getPermissions sample code for java.security.acl.Acl.getPermissions(java.security.Principal) definition code for java.security.acl.Acl.getPermissions(java.security.Principal) (Principal sample code for java.security.Principal definition code for java.security.Principal  user)
          Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group).
 boolean removeEntry sample code for java.security.acl.Acl.removeEntry(java.security.Principal, java.security.acl.AclEntry) definition code for java.security.acl.Acl.removeEntry(java.security.Principal, java.security.acl.AclEntry) (Principal sample code for java.security.Principal definition code for java.security.Principal  caller, AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry  entry)
          Removes an ACL entry from this ACL.
 void setName sample code for java.security.acl.Acl.setName(java.security.Principal, java.lang.String) definition code for java.security.acl.Acl.setName(java.security.Principal, java.lang.String) (Principal sample code for java.security.Principal definition code for java.security.Principal  caller, String sample code for java.lang.String definition code for java.lang.String  name)
          Sets the name of this ACL.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.security.acl.Acl.toString() definition code for java.security.acl.Acl.toString() ()
          Returns a string representation of the ACL contents.
 
Methods inherited from interface java.security.acl.Owner sample code for java.security.acl.Owner definition code for java.security.acl.Owner
addOwner sample code for java.security.acl.Owner.addOwner(java.security.Principal, java.security.Principal) definition code for java.security.acl.Owner.addOwner(java.security.Principal, java.security.Principal) , deleteOwner sample code for java.security.acl.Owner.deleteOwner(java.security.Principal, java.security.Principal) definition code for java.security.acl.Owner.deleteOwner(java.security.Principal, java.security.Principal) , isOwner sample code for java.security.acl.Owner.isOwner(java.security.Principal) definition code for java.security.acl.Owner.isOwner(java.security.Principal)
 

Method Detail

setName sample code for java.security.acl.Acl.setName(java.security.Principal, java.lang.String) definition code for java.security.acl.Acl.setName(java.security.Principal, java.lang.String)

void setName(Principal sample code for java.security.Principal definition code for java.security.Principal  caller,
             String sample code for java.lang.String definition code for java.lang.String  name)
             throws NotOwnerException sample code for java.security.acl.NotOwnerException definition code for java.security.acl.NotOwnerException 
Sets the name of this ACL.

Parameters:
caller - the principal invoking this method. It must be an owner of this ACL.
name - the name to be given to this ACL.
Throws:
NotOwnerException sample code for java.security.acl.NotOwnerException definition code for java.security.acl.NotOwnerException - if the caller principal is not an owner of this ACL.
See Also:
getName() sample code for java.security.acl.Acl.getName() definition code for java.security.acl.Acl.getName()

getName sample code for java.security.acl.Acl.getName() definition code for java.security.acl.Acl.getName()

String sample code for java.lang.String definition code for java.lang.String  getName()
Returns the name of this ACL.

Returns:
the name of this ACL.
See Also:
setName(java.security.Principal, java.lang.String) sample code for java.security.acl.Acl.setName(java.security.Principal, java.lang.String) definition code for java.security.acl.Acl.setName(java.security.Principal, java.lang.String)

addEntry sample code for java.security.acl.Acl.addEntry(java.security.Principal, java.security.acl.AclEntry) definition code for java.security.acl.Acl.addEntry(java.security.Principal, java.security.acl.AclEntry)

boolean addEntry(Principal sample code for java.security.Principal definition code for java.security.Principal  caller,
                 AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry  entry)
                 throws NotOwnerException sample code for java.security.acl.NotOwnerException definition code for java.security.acl.NotOwnerException 
Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) with a set of permissions. Each principal can have at most one positive ACL entry (specifying permissions to be granted to the principal) and one negative ACL entry (specifying permissions to be denied). If there is already an ACL entry of the same type (negative or positive) already in the ACL, false is returned.

Parameters:
caller - the principal invoking this method. It must be an owner of this ACL.
entry - the ACL entry to be added to this ACL.
Returns:
true on success, false if an entry of the same type (positive or negative) for the same principal is already present in this ACL.
Throws:
NotOwnerException sample code for java.security.acl.NotOwnerException definition code for java.security.acl.NotOwnerException - if the caller principal is not an owner of this ACL.

removeEntry sample code for java.security.acl.Acl.removeEntry(java.security.Principal, java.security.acl.AclEntry) definition code for java.security.acl.Acl.removeEntry(java.security.Principal, java.security.acl.AclEntry)

boolean removeEntry(Principal sample code for java.security.Principal definition code for java.security.Principal  caller,
                    AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry  entry)
                    throws NotOwnerException sample code for java.security.acl.NotOwnerException definition code for java.security.acl.NotOwnerException 
Removes an ACL entry from this ACL.

Parameters:
caller - the principal invoking this method. It must be an owner of this ACL.
entry - the ACL entry to be removed from this ACL.
Returns:
true on success, false if the entry is not part of this ACL.
Throws:
NotOwnerException sample code for java.security.acl.NotOwnerException definition code for java.security.acl.NotOwnerException - if the caller principal is not an owner of this Acl.

getPermissions sample code for java.security.acl.Acl.getPermissions(java.security.Principal) definition code for java.security.acl.Acl.getPermissions(java.security.Principal)

Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <Permission sample code for java.security.acl.Permission definition code for java.security.acl.Permission > getPermissions(Principal sample code for java.security.Principal definition code for java.security.Principal  user)
Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group). This set of allowed permissions is calculated as follows:

Parameters:
user - the principal whose permission set is to be returned.
Returns:
the permission set specifying the permissions the principal is allowed.

entries sample code for java.security.acl.Acl.entries() definition code for java.security.acl.Acl.entries()

Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <AclEntry sample code for java.security.acl.AclEntry definition code for java.security.acl.AclEntry > entries()
Returns an enumeration of the entries in this ACL. Each element in the enumeration is of type AclEntry.

Returns:
an enumeration of the entries in this ACL.

checkPermission sample code for java.security.acl.Acl.checkPermission(java.security.Principal, java.security.acl.Permission) definition code for java.security.acl.Acl.checkPermission(java.security.Principal, java.security.acl.Permission)

boolean checkPermission(Principal sample code for java.security.Principal definition code for java.security.Principal  principal,
                        Permission sample code for java.security.acl.Permission definition code for java.security.acl.Permission  permission)
Checks whether or not the specified principal has the specified permission. If it does, true is returned, otherwise false is returned. More specifically, this method checks whether the passed permission is a member of the allowed permission set of the specified principal. The allowed permission set is determined by the same algorithm as is used by the getPermissions method.

Parameters:
principal - the principal, assumed to be a valid authenticated Principal.
permission - the permission to be checked for.
Returns:
true if the principal has the specified permission, false otherwise.
See Also:
getPermissions(java.security.Principal) sample code for java.security.acl.Acl.getPermissions(java.security.Principal) definition code for java.security.acl.Acl.getPermissions(java.security.Principal)

toString sample code for java.security.acl.Acl.toString() definition code for java.security.acl.Acl.toString()

String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string representation of the ACL contents.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of the ACL contents.