Interface ACL
-
- All Known Implementing Classes:
ACLImpl
public interface ACLThis interface represents an Access Control List (ACL), a data structure used to protect access to resources. It is composed of entries, where each entry is represented by the
ALCEntryclass and represents the permissions assigned to a given identity.When a client attempts to perform an operation on a resource, the ACL associated to the resource is used to verify if the client has enough permissions to perform that operation. In order to do that, the
ACLEntrycorresponding to the client's identity is retrieved and then the permission set contained in the entry is verified to decide if access should be granted or not.- Author:
- Stefan Guilhen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddEntry(ACLEntry entry)Adds an entry to this ACL.Collection<? extends ACLEntry>getEntries()Obtains the collection of allACLEntriesin this ACL.ACLEntrygetEntry(String identityOrRole)Obtains the entry that corresponds to the specified identity or role name.ACLEntrygetEntry(Identity identity)Obtains the entry that corresponds to the specified identity.ResourcegetResource()Obtains a reference to the resource being protected by this ACL.booleanisGranted(ACLPermission permission, Identity identity)Verify if the given permission is assigned to the specifiedIdentity.booleanremoveEntry(ACLEntry entry)Removes an entry from this ACL.
-
-
-
Method Detail
-
addEntry
boolean addEntry(ACLEntry entry)
Adds an entry to this ACL. If the ACL already has an
ACLEntryassociated to the new entry's identity, then the new entry will not be added.- Parameters:
entry- theACLEntryto be added.- Returns:
trueif the entry was added;falseotherwise.
-
removeEntry
boolean removeEntry(ACLEntry entry)
Removes an entry from this ACL.
- Parameters:
entry- theACLEntryto be removed.- Returns:
trueif the entry is removed;falseif the entry can't be found in the ACL.
-
getEntries
Collection<? extends ACLEntry> getEntries()
Obtains the collection of all
ACLEntriesin this ACL.- Returns:
- a
Collectioncontaining all entries in this ACL.
-
getEntry
ACLEntry getEntry(Identity identity)
Obtains the entry that corresponds to the specified identity. Calling this method is the same as doing
getEntry(identity.getName()).- Parameters:
identity- a reference to theIdentityobject.- Returns:
- the
ACLEntrythat corresponds to the identity, ornullif no entry could be found.
-
getEntry
ACLEntry getEntry(String identityOrRole)
Obtains the entry that corresponds to the specified identity or role name.
- Parameters:
identityOrRole- aStringrepresenting an identity or role.- Returns:
- the
ACLEntrythat corresponds to the identity or role ornullif no entry could be found.
-
getResource
Resource getResource()
Obtains a reference to the resource being protected by this ACL.
- Returns:
- a reference to the
Resource.
-
isGranted
boolean isGranted(ACLPermission permission, Identity identity)
Verify if the given permission is assigned to the specified
Identity.- Parameters:
permission- theACLPermissionto be checked for.identity- theIdentitybeing verified.- Returns:
trueif the specified permission is assigned to the identity;falseotherwise.
-
-