public final class

PrivateCredentialPermission

extends Permission
java.lang.Object
   ↳ java.security.Permission
     ↳ javax.security.auth.PrivateCredentialPermission

Class Overview

Protects private credential objects belonging to a Subject. It has only one action which is "read". The target name of this permission has a special syntax:

 targetName = CredentialClass {PrincipalClass "PrincipalName"}*
 
First it states a credential class and is followed then by a list of one or more principals identifying the subject.

The principals on their part are specified as the name of the Principal class followed by the principal name in quotes. For example, the following file may define permission to read the private credentials of a principal named "Bob": "com.sun.PrivateCredential com.sun.Principal \"Bob\""

The syntax also allows the use of the wildcard "*" in place of CredentialClass or PrincipalClass and/or PrincipalName.

See Also

Summary

Public Constructors
PrivateCredentialPermission(String name, String action)
Creates a new permission for private credentials specified by the target name name and an action.
Public Methods
boolean equals(Object obj)
Compares the specified object with this Permission for equality and returns true if the specified object is equal, false otherwise.
String getActions()
Returns a comma separated string identifying the actions associated with this permission.
String getCredentialClass()
Returns the class name of the credential associated with this permission.
String[][] getPrincipals()
Returns the principal's classes and names associated with this PrivateCredentialPermission as a two dimensional array.
int hashCode()
Returns the hash code value for this Permission.
boolean implies(Permission permission)
Indicates whether the specified permission is implied by this permission.
PermissionCollection newPermissionCollection()
Returns a specific PermissionCollection container for permissions of this type.
[Expand]
Inherited Methods
From class java.security.Permission
From class java.lang.Object
From interface java.security.Guard

Public Constructors

public PrivateCredentialPermission (String name, String action)

Since: API Level 1

Creates a new permission for private credentials specified by the target name name and an action. The action is always "read".

Parameters
name the target name of the permission.
action the action "read".

Public Methods

public boolean equals (Object obj)

Since: API Level 1

Compares the specified object with this Permission for equality and returns true if the specified object is equal, false otherwise.

The implies(Permission) method should be used for making access control checks.

Parameters
obj object to be compared for equality with this Permission.
Returns
  • true if the specified object is equal to this Permission, otherwise false.

public String getActions ()

Since: API Level 1

Returns a comma separated string identifying the actions associated with this permission. The returned actions are in canonical form. For example:

 sp0 = new SocketPermission("www.google.com", "connect,resolve")
 sp1 = new SocketPermission("www.google.com", "resolve,connect")
 sp0.getActions().equals(sp1.getActions()) //yields true
 
Both permissions return "connect,resolve" (in that order) if #getActions() is invoked. Returns an empty String, if no actions are associated with this permission.

Returns
  • the actions associated with this permission or an empty string if no actions are associated with this permission.

public String getCredentialClass ()

Since: API Level 1

Returns the class name of the credential associated with this permission.

Returns
  • the class name of the credential associated with this permission.

public String[][] getPrincipals ()

Since: API Level 1

Returns the principal's classes and names associated with this PrivateCredentialPermission as a two dimensional array. The first dimension of the array corresponds to the number of principals. The second dimension defines either the name of the PrincipalClass [x][0] or the value of PrincipalName [x][1].

This corresponds to the the target name's syntax:

 targetName = CredentialClass {PrincipalClass "PrincipalName"}*
 

Returns
  • the principal classes and names associated with this PrivateCredentialPermission.

public int hashCode ()

Since: API Level 1

Returns the hash code value for this Permission. Returns the same hash code for Permissions that are equal to each other as required by the general contract of hashCode().

Returns
  • the hash code value for this Permission.

public boolean implies (Permission permission)

Since: API Level 1

Indicates whether the specified permission is implied by this permission. The AccessController uses this method to check whether permission protected access is allowed with the present policy.

Parameters
permission the permission to check against this permission.
Returns
  • true if the specified permission is implied by this permission, false otherwise.

public PermissionCollection newPermissionCollection ()

Since: API Level 1

Returns a specific PermissionCollection container for permissions of this type. Returns null if any permission collection can be used.

Subclasses may override this method to return an appropriate collection for the specific permissions they implement.

Returns