java.lang.Object
java.security.Permission
javax.security.auth.PrivateCredentialPermission
- All Implemented Interfaces:
- Serializable,- Guard
This class is used to protect access to private Credentials
 belonging to a particular 
Subject.  The Subject
 is represented by a Set of Principals.
  The target name of this Permission specifies
 a Credential class name, and a Set of Principals.
 The only valid value for this Permission's actions is, "read".
 The target name must abide by the following syntax:
 
      CredentialClass {PrincipalClass "PrincipalName"}*
 
 For example, the following permission grants access to the
 com.sun.PrivateCredential owned by Subjects which have
 a com.sun.Principal with the name, "duke".  Note that although
 this example, as well as all the examples below, do not contain
 Codebase, SignedBy, or Principal information in the grant statement
 (for simplicity reasons), actual policy configurations should
 specify that information when appropriate.
 
    grant {
      permission javax.security.auth.PrivateCredentialPermission
              "com.sun.PrivateCredential com.sun.Principal \"duke\"",
              "read";
    };
 
 If CredentialClass is "*", then access is granted to
 all private Credentials belonging to the specified
 Subject.
 If "PrincipalName" is "*", then access is granted to the
 specified Credential owned by any Subject that has the
 specified Principal (the actual PrincipalName doesn't matter).
 For example, the following grants access to the
 a.b.Credential owned by any Subject that has
 an a.b.Principal.
 
    grant {
      permission javax.security.auth.PrivateCredentialPermission
              "a.b.Credential a.b.Principal "*"",
              "read";
    };
 
 If both the PrincipalClass and "PrincipalName" are "*",
 then access is granted to the specified Credential owned by
 any Subject.
 In addition, the PrincipalClass/PrincipalName pairing may be repeated:
    grant {
      permission javax.security.auth.PrivateCredentialPermission
              "a.b.Credential a.b.Principal "duke" c.d.Principal "dukette"",
              "read";
    };
 
 The above grants access to the private Credential, "a.b.Credential",
 belonging to a Subject with at least two associated Principals:
 "a.b.Principal" with the name, "duke", and "c.d.Principal", with the name,
 "dukette".- Since:
- 1.4
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionPrivateCredentialPermission(String name, String actions) Creates a newPrivateCredentialPermissionwith the specifiedname.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanChecks twoPrivateCredentialPermissionobjects for equality.Returns the "canonical string representation" of the actions.Returns the Class name of the Credential associated with thisPrivateCredentialPermission.String[][]Returns thePrincipalclasses and names associated with thisPrivateCredentialPermission.inthashCode()Returns the hash code value for this object.booleanChecks if thisPrivateCredentialPermissionimplies the specifiedPermission.Return a homogeneous collection of PrivateCredentialPermissions in aPermissionCollection.Methods declared in class java.security.PermissioncheckGuard, getName, toString
- 
Constructor Details- 
PrivateCredentialPermissionCreates a newPrivateCredentialPermissionwith the specifiedname. Thenamespecifies both a Credential class and aPrincipalSet.- Parameters:
- name- the name specifying the Credential class and- PrincipalSet.
- actions- the actions specifying that the Credential can be read.
- Throws:
- IllegalArgumentException- if- namedoes not conform to the correct syntax or if- actionsis not "read".
 
 
- 
- 
Method Details- 
getCredentialClassReturns the Class name of the Credential associated with thisPrivateCredentialPermission.- Returns:
- the Class name of the Credential associated with this
          PrivateCredentialPermission.
 
- 
getPrincipalsReturns thePrincipalclasses and names associated with thisPrivateCredentialPermission. The information is returned as a two-dimensional array (array[x][y]). The 'x' value corresponds to the number ofPrincipalclass and name pairs. When (y==0), it corresponds to thePrincipalclass value, and when (y==1), it corresponds to thePrincipalname value. For example, array[0][0] corresponds to the class name of the firstPrincipalin the array. array[0][1] corresponds to thePrincipalname of the firstPrincipalin the array.- Returns:
- the Principalclass and names associated with thisPrivateCredentialPermission.
 
- 
impliesChecks if thisPrivateCredentialPermissionimplies the specifiedPermission.This method returns true if: -  pis an instanceof PrivateCredentialPermission and
-  the target name for pis implied by this object's target name. For example:[* P1 "duke"] implies [a.b.Credential P1 "duke"]. [C1 P1 "duke"] implies [C1 P1 "duke" P2 "dukette"]. [C1 P2 "dukette"] implies [C1 P1 "duke" P2 "dukette"]. 
 - Specified by:
- impliesin class- Permission
- Parameters:
- p- the- Permissionto check against.
- Returns:
- true if this PrivateCredentialPermissionimplies the specifiedPermission, false if not.
 
-  
- 
equalsChecks twoPrivateCredentialPermissionobjects for equality. Checks thatobjis aPrivateCredentialPermission, and has the same credential class as this object, as well as the same Principals as this object. The order of the Principals in the respective Permission's target names is not relevant.- Specified by:
- equalsin class- Permission
- Parameters:
- obj- the object we are testing for equality with this object.
- Returns:
- true if obj is a PrivateCredentialPermission, has the same credential class as this object, and has the same Principals as this object.
- See Also:
 
- 
hashCodepublic int hashCode()Returns the hash code value for this object.- Specified by:
- hashCodein class- Permission
- Returns:
- a hash code value for this object.
- See Also:
 
- 
getActionsReturns the "canonical string representation" of the actions. This method always returns the String, "read".- Specified by:
- getActionsin class- Permission
- Returns:
- the actions (always returns "read").
 
- 
newPermissionCollectionReturn a homogeneous collection of PrivateCredentialPermissions in aPermissionCollection. No suchPermissionCollectionis defined, so this method always returnsnull.- Overrides:
- newPermissionCollectionin class- Permission
- Returns:
- null in all cases.
 
 
-