org.systinet.security.policy
Class AcceptingUpdateablePolicy

java.lang.Object
  extended byjavax.security.auth.Policy
      extended byorg.systinet.security.policy.UpdateablePolicy
          extended byorg.systinet.security.policy.AcceptingUpdateablePolicy

public class AcceptingUpdateablePolicy
extends UpdateablePolicy

Acts as a read-only updatable policy, which grants all permissons to any principal. Extension methods (those that are not in standard Java Policy) always throw AccessControlException with the unsupported information message.

Since:
4.0
Component:
Security-Specific

Field Summary
 
Fields inherited from class org.systinet.security.policy.UpdateablePolicy
WASP_POLICY_CHECKER, WASP_POLICY_IMPL
 
Constructor Summary
AcceptingUpdateablePolicy()
          Construtor.
AcceptingUpdateablePolicy(java.util.Map map)
          Construtor.
 
Method Summary
 boolean addPermission(java.security.CodeSource cs, java.security.Principal principal, java.security.Permission permission)
          Adds a single permission to specified principal.
 void addPermissions(java.security.CodeSource cs, java.security.Principal principal, java.security.PermissionCollection collection)
          Adds collection of permissions to specified principal.
 boolean addPermissionToRole(java.lang.String roleName, java.security.Permission permission)
          Adds permission to role.
 java.security.PermissionCollection getPermissions(javax.security.auth.Subject subject, java.security.CodeSource codesource)
          Retrieve the Permissions granted to the Principals associated with the specified CodeSource, always returns a collection containg AllPermissons .
 PrincipalEntries getPrincipalEntries()
          Returns enumeration of principal entries that are granted with specified atomic permission.
 PrincipalEntries getPrincipalEntries(java.security.Permission perm)
          Returns enumeration of principal entries that are granted with specified atomic permission.
 java.security.PermissionCollection getPrincipalPermissions(java.security.CodeSource cs, java.security.Principal principal)
          Returns permissions associated with the principal, also with permissions inheritted from roles.
 java.security.PermissionCollection getPrincipalPermissions(java.security.CodeSource cs, java.security.Principal principal, boolean roleInheritted)
          Returns permissions associated with the principal only (typically supplied by a grant entry for this principal).
 java.util.Iterator getRoleNames()
          Returns iterator of role names.
 java.security.PermissionCollection getRolePermissions(java.lang.String roleName)
          Get permissions owned by role.
 boolean isRoleManager()
          It tests, whether this policy can manage roles or not.
 boolean isUpdatable()
          It tests, whether this policy is really updateable or read-only.
 void refresh()
          Refresh and reload the Policy.
 boolean removePermission(java.security.CodeSource cs, java.security.Principal principal, java.security.Permission permission)
          Removes permission from specified principal.
 boolean removePermissionFromRole(java.lang.String roleName, java.security.Permission permission)
          Removes permission from role.
 
Methods inherited from class org.systinet.security.policy.UpdateablePolicy
createRole, deleteRole, destroy, getUpdateablePolicy, initSingleton, setUpdateablePolicy
 
Methods inherited from class javax.security.auth.Policy
getPolicy, setPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptingUpdateablePolicy

public AcceptingUpdateablePolicy(java.util.Map map)
Construtor.

Parameters:
map - ignored, can be null

AcceptingUpdateablePolicy

public AcceptingUpdateablePolicy()
Construtor.

Method Detail

isUpdatable

public boolean isUpdatable()
It tests, whether this policy is really updateable or read-only. It always return false

Specified by:
isUpdatable in class UpdateablePolicy
Returns:
false, because the policy is read-only

isRoleManager

public boolean isRoleManager()
It tests, whether this policy can manage roles or not. It always returns false.

Specified by:
isRoleManager in class UpdateablePolicy
Returns:
false, because it cannot manage roles

refresh

public void refresh()
Refresh and reload the Policy. This method is empty.

Specified by:
refresh in class UpdateablePolicy

getPermissions

public java.security.PermissionCollection getPermissions(javax.security.auth.Subject subject,
                                                         java.security.CodeSource codesource)
Retrieve the Permissions granted to the Principals associated with the specified CodeSource, always returns a collection containg AllPermissons .

Specified by:
getPermissions in class UpdateablePolicy
Parameters:
subject - the Subject whose associated Principals, in conjunction with the provided CodeSource, determines the Permissions returned by this method. This parameter may be null.
codesource - the code specified by its CodeSource that determines, in conjunction with the provided Subject, the Permissions returned by this method. This parameter may be null.
Returns:
the Collection containing AllPermission

addPermissions

public void addPermissions(java.security.CodeSource cs,
                           java.security.Principal principal,
                           java.security.PermissionCollection collection)
                    throws java.security.AccessControlException
Adds collection of permissions to specified principal. It always throws AccessControlException, because the policy is read only.

Specified by:
addPermissions in class UpdateablePolicy
Parameters:
cs - codesource for this
principal - principal permission (can be null)
collection - collection of permission to be added to a principal
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

addPermission

public boolean addPermission(java.security.CodeSource cs,
                             java.security.Principal principal,
                             java.security.Permission permission)
                      throws java.security.AccessControlException
Adds a single permission to specified principal. It always throws AccessControlException, because the policy is read only.

Specified by:
addPermission in class UpdateablePolicy
Parameters:
cs - codesource for this permission (can be null)
principal - principal
permission - permission to add
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

removePermission

public boolean removePermission(java.security.CodeSource cs,
                                java.security.Principal principal,
                                java.security.Permission permission)
                         throws java.security.AccessControlException
Removes permission from specified principal. It always throws AccessControlException, because the policy is read only.

Specified by:
removePermission in class UpdateablePolicy
Parameters:
cs - codesource for this permission (can be null)
principal - principal
permission - the permission has to match exactly (tested through equals method) to one of the permissions already assigned to the principal.
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

getPrincipalPermissions

public java.security.PermissionCollection getPrincipalPermissions(java.security.CodeSource cs,
                                                                  java.security.Principal principal)
                                                           throws java.security.AccessControlException
Returns permissions associated with the principal, also with permissions inheritted from roles. It always throws AccessControlException, because the policy is read only.

Specified by:
getPrincipalPermissions in class UpdateablePolicy
Parameters:
cs - codesource for this permission (can be null)
principal - principal (can be null)
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

getPrincipalPermissions

public java.security.PermissionCollection getPrincipalPermissions(java.security.CodeSource cs,
                                                                  java.security.Principal principal,
                                                                  boolean roleInheritted)
                                                           throws java.security.AccessControlException
Returns permissions associated with the principal only (typically supplied by a grant entry for this principal). It always throws AccessControlException, because the policy is read only.

Specified by:
getPrincipalPermissions in class UpdateablePolicy
Parameters:
cs - codesource for this permission (can be null)
principal - principal (can be null)
roleInheritted - true means that the returned permissions also contain permissions inheritted principal's roles
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

getPrincipalEntries

public PrincipalEntries getPrincipalEntries()
                                     throws java.security.AccessControlException
Returns enumeration of principal entries that are granted with specified atomic permission. The permission is atomic if both its name and actions are not composed values. It always throws AccessControlException, because the policy is read only.

Specified by:
getPrincipalEntries in class UpdateablePolicy
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

getPrincipalEntries

public PrincipalEntries getPrincipalEntries(java.security.Permission perm)
                                     throws java.security.AccessControlException
Returns enumeration of principal entries that are granted with specified atomic permission. The permission is atomic if both its name and actions are not composed values. It always throws AccessControlException, because the policy is read only.

Specified by:
getPrincipalEntries in class UpdateablePolicy
Parameters:
perm - permission act as filter for the constructed result
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

getRoleNames

public java.util.Iterator getRoleNames()
                                throws java.security.AccessControlException
Returns iterator of role names. It always throws AccessControlException, because the policy cannot manage roles.

Specified by:
getRoleNames in class UpdateablePolicy
Returns:
iterator of role names (string values)
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

addPermissionToRole

public boolean addPermissionToRole(java.lang.String roleName,
                                   java.security.Permission permission)
Adds permission to role. It always throws AccessControlException, because the policy cannot manage roles.

Specified by:
addPermissionToRole in class UpdateablePolicy
Parameters:
roleName - role name
permission - permission to add, can be null to cteate empty role entry
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

removePermissionFromRole

public boolean removePermissionFromRole(java.lang.String roleName,
                                        java.security.Permission permission)
Removes permission from role. It always throws AccessControlException, because the policy cannot manage roles.

Specified by:
removePermissionFromRole in class UpdateablePolicy
Parameters:
roleName - role name
permission - permission to remove (can be null to remove the role) , the permission has to match exactly (tested through equals method) to one of the permissions already assigned to the role.
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation

getRolePermissions

public java.security.PermissionCollection getRolePermissions(java.lang.String roleName)
Get permissions owned by role. It always throws AccessControlException, because the policy cannot manage roles.

Specified by:
getRolePermissions in class UpdateablePolicy
Parameters:
roleName - role name
Returns:
it always throws AccessControllException
Throws:
java.security.AccessControlException - access control rules disallows to perform requested operation