BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.security.acl
Class AclImpl

java.lang.Object
  |
  +--weblogic.security.acl.OwnerImpl
        |
        +--weblogic.security.acl.AclImpl
Direct Known Subclasses:
URLAcl

public class AclImpl
extends OwnerImpl
implements java.security.acl.Acl, java.io.Serializable

This class implements the java.security.acl.Acl interface with optimization for checking permissions.

The implementation manages permissions in groups of 32. Each group has separate hash tables mapping groups and users to pairs of bit masks representing granted and not denied permissions. Permission is checked by finding the right group, computing the bitmask corresponding to the specific permission, and doing the bit arithmetic.

The AclEntry objects used in the interfaces are not kept. They are analyzed on input and synthesized on demand.

An ACL is a data structure with multiple AclEntry objects. Each AclEntry object contains a set of permissions associated with a particular principal, which represents an entity such as an individual user or a group).

Additionally, each AclEntry is specified as either positive or negative. If positive, the permissions are to be granted to the associated principal. If negative, the permissions are to be denied.

Each AclEntry in each ACL observes 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 AclEntry to the ACL.

Author:
Copyright (c) 1997 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1999 by BEA WebXpress. All Rights Reserved.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.
See Also:
AclEntry, Owner, Acl.getPermissions(java.security.Principal), Serialized Form

Constructor Summary
AclImpl(java.security.Principal caller, java.lang.String name)
          Sets the name of an ACL to the specified string.
 
Method Summary
 boolean addEntry(java.security.Principal caller, java.security.acl.AclEntry entry)
          Adds an AclEntry.
 boolean checkPermission(java.security.Principal principal, java.security.acl.Permission permission)
          Determines whether the specified principal has the specified permission.
 java.util.Enumeration entries()
          Returns an enumeration of the entries in an ACL.
 java.lang.String getName()
          Returns the name of this ACL as a string.
protected  int getPermission(java.security.Principal principal, java.security.acl.Permission permission)
           
 java.util.Enumeration getPermissions(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(java.security.Principal caller, java.security.acl.AclEntry entry)
          Removes an AclEntry from an ACL.
 void setName(java.security.Principal caller, java.lang.String name)
          Sets the name of an ACL to the specified string.
 java.lang.String toString()
          Returns a string representation of the contents of an ACL.
 
Methods inherited from class weblogic.security.acl.OwnerImpl
addOwner, deleteOwner, isOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AclImpl

public AclImpl(java.security.Principal caller,
               java.lang.String name)
Sets the name of an ACL to the specified string. The principal that owns the ACL must be supplied.

Parameters:
principal - Principal that owns the ACL
name - Name for the ACL
Method Detail

setName

public void setName(java.security.Principal caller,
                    java.lang.String name)
             throws java.security.acl.NotOwnerException
Sets the name of an ACL to the specified string. The principal that owns the ACL must be supplied.
Specified by:
setName in interface java.security.acl.Acl

Parameters:
principal - Principal that owns the ACL
name - Name for the ACL
Throws:
java.security.acl.NotOwnerException - if the caller principal does not own the ACL

getName

public java.lang.String getName()
Returns the name of this ACL as a string.
Specified by:
getName in interface java.security.acl.Acl

Returns:
ACL name

addEntry

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

The principal that owns the ACL must be supplied.

Specified by:
addEntry in interface java.security.acl.Acl

Parameters:
caller - Principal that owns the ACL
entry - AclEntry to be added to an ACL
Returns:
false if an entry of the same type (positive or negative) for the same principal is already present
Throws:
java.security.acl.NotOwnerException - if the caller principal does not own the ACL

removeEntry

public boolean removeEntry(java.security.Principal caller,
                           java.security.acl.AclEntry entry)
                    throws java.security.acl.NotOwnerException
Removes an AclEntry from an ACL. The principal that owns the ACL must be supplied.
Specified by:
removeEntry in interface java.security.acl.Acl

Parameters:
caller - Principal that owns the ACL
entry - AclEntry to be removed from an ACL
Returns:
false if there is no entry
Throws:
java.security.acl.NotOwnerException - if the caller principal does not own the ACL

getPermissions

public java.util.Enumeration getPermissions(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:

Specified by:
getPermissions in interface java.security.acl.Acl

Parameters:
user - Principal whose permission set is to be returned
Returns:
Enumeration of permissions the principal is allowed

entries

public java.util.Enumeration entries()
Returns an enumeration of the entries in an ACL. Each element in the enumeration is of type AclEntry.
Specified by:
entries in interface java.security.acl.Acl

Returns:
Enumeration of the entries in an ACL

checkPermission

public boolean checkPermission(java.security.Principal principal,
                               java.security.acl.Permission permission)
Determines whether the specified principal has the specified permission. True is returned if so; 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.

Specified by:
checkPermission in interface java.security.acl.Acl

Parameters:
principal - Principal (assumed to be a valid authenticated Principal)
permission - Permission to be checked for
Returns:
true if the principal has the specified permission
See Also:
getPermissions(java.security.Principal)

getPermission

protected int getPermission(java.security.Principal principal,
                            java.security.acl.Permission permission)


toString

public java.lang.String toString()
Returns a string representation of the contents of an ACL.
Specified by:
toString in interface java.security.acl.Acl

Returns:
String representation of the ACL contents
Overrides:
toString in class java.lang.Object

Documentation is available at
http://www.weblogic.com/docs51