public class BasicHive extends Object implements Hive
Constructor and Description |
---|
BasicHive()
Construct.
|
Modifier and Type | Method and Description |
---|---|
void |
addPermission(Principal principal,
Permission permission)
Adds a new permission to a principal.
|
void |
addPrincipal(Principal principal,
Collection<Permission> permissions)
Adds a new Principal to the hive.
|
protected Boolean |
cacheLookUp(Subject subject,
Permission permission)
Allows subclasses to retrieve previously cached results and thus speed up the check.
|
protected void |
cacheResult(Subject subject,
Permission permission,
boolean result)
Allows subclasses to cache the result of a check and thus speed up this check the next time.
|
boolean |
containsPermission(Permission permission)
Checks if this hive contains exactly the permission.
|
boolean |
containsPrincipal(Principal principal)
Checks if this hive contains an exact match for this principal.
|
Set<Permission> |
getPermissions(Principal principal)
Returns a set of
Permission s, contained within the principal. |
Set<Principal> |
getPrincipals(Permission permission)
Returns a set of
Principal s, each containing this permission. |
boolean |
hasPermission(Subject subject,
Permission permission)
Checks if the subject has the exact permission, or if the permission is implied by any of the
subjects principals.
|
boolean |
isLocked()
Check if the hive is locked.
|
void |
lock()
Locks this hive.
|
public final void lock()
isLocked()
will return
true;public final boolean isLocked()
public final void addPrincipal(Principal principal, Collection<Permission> permissions)
principal
- the principalpermissions
- a required collection of granted permissions for the principalIllegalStateException
- if the hive is lockedIllegalArgumentException
- if either parameter is nullpublic final void addPermission(Principal principal, Permission permission)
principal
- the principalpermission
- the permission grantedIllegalStateException
- if the hive is lockedIllegalArgumentException
- if either parameter is nullpublic final boolean containsPrincipal(Principal principal)
Hive
containsPrincipal
in interface Hive
Hive.containsPrincipal(org.wicketstuff.security.hive.authorization.Principal)
protected Boolean cacheLookUp(Subject subject, Permission permission)
subject
- (optional) subjectpermission
- the permission to checkprotected void cacheResult(Subject subject, Permission permission, boolean result)
subject
- (optional) subjectpermission
- the permission to checkresult
- the result of the permissionpublic final boolean hasPermission(Subject subject, Permission permission)
Hive
hasPermission
in interface Hive
subject
- the (optional) subjectpermission
- the permission to check.Hive.hasPermission(org.wicketstuff.security.hive.authentication.Subject,
org.wicketstuff.security.hive.authorization.Permission)
public final boolean containsPermission(Permission permission)
Hive
containsPermission
in interface Hive
Hive.containsPermission(org.wicketstuff.security.hive.authorization.Permission)
public final Set<Permission> getPermissions(Principal principal)
Hive
Permission
s, contained within the principal. Implementors must not
allow modifications to the set change the internal state of the hive.getPermissions
in interface Hive
Hive.getPermissions(org.wicketstuff.security.hive.authorization.Principal)
public final Set<Principal> getPrincipals(Permission permission)
Hive
Principal
s, each containing this permission. Implementors must not
allow modifications to the set change the internal state of the hive.getPrincipals
in interface Hive
Hive.getPrincipals(org.wicketstuff.security.hive.authorization.Permission)
Copyright © 2015. All rights reserved.