|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.easybeans.security.jacc.provider.JPolicyConfiguration
public class JPolicyConfiguration
Defines the PolicyConfiguration implementation class of JACC.
Nested Class Summary | |
---|---|
private static class |
JPolicyConfiguration.State
Available states. |
Field Summary | |
---|---|
private java.lang.String |
contextID
ContextID string which differentiate all instances. |
private java.security.PermissionCollection |
excludedPermissions
Excluded permissions. |
private static JLog |
logger
Logger. |
private java.util.Map<java.lang.String,java.security.PermissionCollection> |
rolePermissions
Role permissions. |
private JPolicyConfiguration.State |
state
Current state. |
private java.security.PermissionCollection |
uncheckedPermissions
Unchecked permissions. |
Constructor Summary | |
---|---|
JPolicyConfiguration(java.lang.String contextID)
Constructor of a new PolicyConfiguration object. |
Method Summary | |
---|---|
void |
addToExcludedPolicy(java.security.Permission permission)
Used to add a single excluded policy statement to this PolicyConfiguration. |
void |
addToExcludedPolicy(java.security.PermissionCollection permissions)
Used to add excluded policy statements to this PolicyConfiguration. |
void |
addToRole(java.lang.String roleName,
java.security.Permission permission)
Used to add a single permission to a named role in this PolicyConfiguration. |
void |
addToRole(java.lang.String roleName,
java.security.PermissionCollection permissions)
Used to add permissions to a named role in this PolicyConfiguration. |
void |
addToUncheckedPolicy(java.security.Permission permission)
Used to add a single unchecked policy statement to this PolicyConfiguration. |
void |
addToUncheckedPolicy(java.security.PermissionCollection permissions)
Used to add unchecked policy statements to this PolicyConfiguration. |
private void |
checkCurrentStateIsInState(JPolicyConfiguration.State s)
Check if the current state is in the given state. |
private void |
checkCurrentStateNotInState(JPolicyConfiguration.State s)
Check if the current state is not the given state. |
private void |
checkSetPolicy()
Method which check setPolicy access. |
void |
commit()
This method is used to set to "inService" the state of the policy context whose interface is this PolicyConfiguration Object. |
void |
delete()
Causes all policy statements to be deleted from this PolicyConfiguration and sets its internal state such that calling any method, other than delete, getContextID, or inService on the PolicyConfiguration will be rejected and cause an UnsupportedOperationException to be thrown. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
java.lang.String |
getContextID()
This method returns this object's policy context identifier. |
java.security.PermissionCollection |
getExcludedPermissions()
Gets the excluded permission. |
java.security.PermissionCollection |
getPermissionsForPrincipal(java.security.Principal principal)
Gets the permissions for a given principal. |
java.security.PermissionCollection |
getUncheckedPermissions()
Gets the excluded permission. |
int |
hashCode()
Gets a hash code value for the object. |
boolean |
inService()
This method is used to determine if the policy context whose interface is this PolicyConfiguration Object is in the "inService" state. |
void |
linkConfiguration(javax.security.jacc.PolicyConfiguration link)
Creates a relationship between this configuration and another such that they share the same principal-to-role mappings. |
void |
removeExcludedPolicy()
Used to remove any excluded policy statements from this PolicyConfiguration. |
void |
removeRole(java.lang.String roleName)
Used to remove a role and all its permissions from this PolicyConfiguration. |
void |
removeUncheckedPolicy()
Used to remove any unchecked policy statements from this PolicyConfiguration. |
protected void |
resetState()
Reset to OPEN state (Used by PolicyConfigurationFactory). |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private JPolicyConfiguration.State state
private java.lang.String contextID
private static JLog logger
private java.security.PermissionCollection excludedPermissions
private java.security.PermissionCollection uncheckedPermissions
private java.util.Map<java.lang.String,java.security.PermissionCollection> rolePermissions
Constructor Detail |
---|
public JPolicyConfiguration(java.lang.String contextID)
contextID
- Identifier of this PolicyConfiguration objectMethod Detail |
---|
public void addToExcludedPolicy(java.security.Permission permission) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
addToExcludedPolicy
in interface javax.security.jacc.PolicyConfiguration
permission
- the permission to be added to the excluded policy
statements.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
addToExcludedPolicy method signature. The exception thrown by the
implementation class will be encapsulated (during construction)
in the thrown PolicyContextException.public void addToExcludedPolicy(java.security.PermissionCollection permissions) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
addToExcludedPolicy
in interface javax.security.jacc.PolicyConfiguration
permissions
- the collection of permissions to be added to the
excluded policy statements. The collection may be either a
homogenous or heterogenous collection.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
addToExcludedPolicy method signature. The exception thrown by the
implementation class will be encapsulated (during construction)
in the thrown PolicyContextException.public void addToRole(java.lang.String roleName, java.security.Permission permission) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
addToRole
in interface javax.security.jacc.PolicyConfiguration
roleName
- the name of the Role to which the permission is to be
added.permission
- the permission to be added to the role.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- - if the implementation throws a checked
exception that has not been accounted for by the addToRole method
signature. The exception thrown by the implementation class will
be encapsulated (during construction) in the thrown
PolicyContextException.public void addToRole(java.lang.String roleName, java.security.PermissionCollection permissions) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
addToRole
in interface javax.security.jacc.PolicyConfiguration
roleName
- the name of the Role to which the permissions are to be
added.permissions
- the collection of permissions to be added to the role.
The collection may be either a homogenous or heterogenous
collection.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or inService" when this method is called.
javax.security.jacc.PolicyContextException
- - if the implementation throws a checked
exception that has not been accounted for by the addToRole method
signature. The exception thrown by the implementation class will
be encapsulated (during construction) in the thrown
PolicyContextException.public void addToUncheckedPolicy(java.security.Permission permission) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
addToUncheckedPolicy
in interface javax.security.jacc.PolicyConfiguration
permission
- the permission to be added to the unchecked policy
statements.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
addToUncheckedPolicy method signature. The exception thrown by
the implementation class will be encapsulated (during
construction) in the thrown PolicyContextException.public void addToUncheckedPolicy(java.security.PermissionCollection permissions) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
addToUncheckedPolicy
in interface javax.security.jacc.PolicyConfiguration
permissions
- the collection of permissions to be added as unchecked
policy statements. The collection may be either a homogenous or
heterogenous collection.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
addToUncheckedPolicy method signature. The exception thrown by
the implementation class will be encapsulated (during
construction) in the thrown PolicyContextException.public void commit() throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
commit
in interface javax.security.jacc.PolicyConfiguration
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the commit method
signature. The exception thrown by the implementation class will
be encapsulated (during construction) in the thrown
PolicyContextException.public void delete() throws javax.security.jacc.PolicyContextException, java.lang.SecurityException
delete
in interface javax.security.jacc.PolicyConfiguration
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the delete method
signature. The exception thrown by the implementation class will
be encapsulated (during construction) in the thrown
PolicyContextException.public java.lang.String getContextID() throws javax.security.jacc.PolicyContextException, java.lang.SecurityException
getContextID
in interface javax.security.jacc.PolicyConfiguration
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the getContextID
method signature. The exception thrown by the implementation
class will be encapsulated (during construction) in the thrown
PolicyContextException.public boolean inService() throws javax.security.jacc.PolicyContextException, java.lang.SecurityException
inService
in interface javax.security.jacc.PolicyConfiguration
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the inService method
signature. The exception thrown by the implementation class will
be encapsulated (during construction) in the thrown
PolicyContextException.public void linkConfiguration(javax.security.jacc.PolicyConfiguration link) throws java.lang.IllegalArgumentException, javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
linkConfiguration
in interface javax.security.jacc.PolicyConfiguration
link
- a reference to a different PolicyConfiguration than this
PolicyConfiguration. The relationship formed by this method is
symetric, transitive and idempotent. If the argument
PolicyConfiguration does not have a different Policy context
identifier than this PolicyConfiguration no relationship is
formed, and an exception, as described below, is thrown.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
java.lang.IllegalArgumentException
- if called with an argument
PolicyConfiguration whose Policy context is equivalent to that of
this PolicyConfiguration.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
linkConfiguration method signature. The exception thrown by the
implementation class will be encapsulated (during construction)
in the thrown PolicyContextException.public void removeExcludedPolicy() throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
removeExcludedPolicy
in interface javax.security.jacc.PolicyConfiguration
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
removeExcludedPolicy method signature. The exception thrown by
the implementation class will be encapsulated (during
construction) in the thrown PolicyContextException.public void removeRole(java.lang.String roleName) throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
removeRole
in interface javax.security.jacc.PolicyConfiguration
roleName
- the name of the Role to remove from this
PolicyConfiguration.
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the removeRole
method signature. The exception thrown by the implementation
class will be encapsulated (during construction) in the thrown
PolicyContextException.public void removeUncheckedPolicy() throws javax.security.jacc.PolicyContextException, java.lang.SecurityException, java.lang.UnsupportedOperationException
removeUncheckedPolicy
in interface javax.security.jacc.PolicyConfiguration
java.lang.SecurityException
- if called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.
java.lang.UnsupportedOperationException
- if the state of the policy context
whose interface is this PolicyConfiguration Object is "deleted"
or "inService" when this method is called.
javax.security.jacc.PolicyContextException
- if the implementation throws a checked
exception that has not been accounted for by the
removeUncheckedPolicy method signature. The exception thrown by
the implementation class will be encapsulated (during
construction) in the thrown PolicyContextException.private void checkCurrentStateNotInState(JPolicyConfiguration.State s) throws java.lang.UnsupportedOperationException
s
- given state
java.lang.UnsupportedOperationException
- if the state is not the given stateprivate void checkCurrentStateIsInState(JPolicyConfiguration.State s) throws java.lang.UnsupportedOperationException
s
- given state
java.lang.UnsupportedOperationException
- if the state is not in a valid
stateprivate void checkSetPolicy() throws java.lang.SecurityException
java.lang.SecurityException
- when called by an AccessControlContext that has
not been granted the "setPolicy" SecurityPermission.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.
public int hashCode()
hashCode
in class java.lang.Object
protected void resetState()
public java.security.PermissionCollection getExcludedPermissions()
public java.security.PermissionCollection getUncheckedPermissions()
public java.security.PermissionCollection getPermissionsForPrincipal(java.security.Principal principal)
principal
- given principal
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |