Top Description Inners Fields Constructors Methods
javax.security.auth

public final Class PrivateCredentialPermission

extends Permission
Class Inheritance
Imports
java.util.*, java.io.IOException, java.text.MessageFormat, java.security.Permission, .PermissionCollection, .Principal, sun.security.util.ResourcesMgr

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private String
private transient PrivateCredentialPermission.CredOwner[]
private static final PrivateCredentialPermission.CredOwner[]
private Set<Principal>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
PrivateCredentialPermission(String credentialClass, Set<Principal> principals)

Create a new PrivateCredentialPermission with the specified credentialClass and Principals.

public
PrivateCredentialPermission(String
the name specifying the Credential class and Principal Set.
name
,
String
the actions specifying that the Credential can be read.
actions
)

Creates a new PrivateCredentialPermission with the specified name.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if obj is a PrivateCredentialPermission, has the same credential class as this object, and has the same Principals as this object.
equals
(Object
the object we are testing for equality with this object.
obj
)

Implements abstract java.security.Permission.equals.

Checks two PrivateCredentialPermission objects for equality.

public String

Returns:

the actions (always returns "read").
getActions
()

Implements abstract java.security.Permission.getActions.

Returns the "canonical string representation" of the actions.

public String

Returns:

the Class name of the Credential associated with this PrivateCredentialPermission.
getCredentialClass
()

Returns the Class name of the Credential associated with this PrivateCredentialPermission.

public String[][]

Returns:

the Principal class and names associated with this PrivateCredentialPermission.
getPrincipals
()

Returns the Principal classes and names associated with this PrivateCredentialPermission.

public int

Returns:

the hash code value for this object
hashCode
()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this object.

public boolean

Returns:

true if this PrivateCredentialPermission implies the specified Permission, false if not.
implies
(Permission
the Permission to check against.
p
)

Implements abstract java.security.Permission.implies.

Checks if this PrivateCredentialPermission implies the specified Permission.

private boolean
private boolean
private void
init(String name)

public PermissionCollection

Returns:

null in all cases.
newPermissionCollection
()

Overrides java.security.Permission.newPermissionCollection.

Return a homogeneous collection of PrivateCredentialPermissions in a PermissionCollection.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
s
)

Reads this object from a stream (i.e., deserializes it)

Inherited from java.security.Permission:
checkGuardgetNametoString

Field Detail

credentialClassback to summary
private String credentialClass
credOwnersback to summary
private transient PrivateCredentialPermission.CredOwner[] credOwners
EMPTY_PRINCIPALSback to summary
private static final PrivateCredentialPermission.CredOwner[] EMPTY_PRINCIPALS
principalsback to summary
private Set<Principal> principals
Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Annotations
@Serial

Constructor Detail

PrivateCredentialPermissionback to summary
pack-priv PrivateCredentialPermission(String credentialClass, Set<Principal> principals)

Create a new PrivateCredentialPermission with the specified credentialClass and Principals.

PrivateCredentialPermissionback to summary
public PrivateCredentialPermission(String name, String actions)

Creates a new PrivateCredentialPermission with the specified name. The name specifies both a Credential class and a Principal Set.

Parameters
name:String

the name specifying the Credential class and Principal Set.

actions:String

the actions specifying that the Credential can be read.

Exceptions
IllegalArgumentException:
if name does not conform to the correct syntax or if actions is not "read".

Method Detail

equalsback to summary
public boolean equals(Object obj)

Implements abstract java.security.Permission.equals.

Checks two PrivateCredentialPermission objects for equality. Checks that obj is a PrivateCredentialPermission, 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.

Parameters
obj:Object

the object we are testing for equality with this object.

Returns:boolean

true if obj is a PrivateCredentialPermission, has the same credential class as this object, and has the same Principals as this object.

Annotations
@Override
getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.getActions.

Returns the "canonical string representation" of the actions. This method always returns the String, "read".

Returns:String

the actions (always returns "read").

getCredentialClassback to summary
public String getCredentialClass()

Returns the Class name of the Credential associated with this PrivateCredentialPermission.

Returns:String

the Class name of the Credential associated with this PrivateCredentialPermission.

getPrincipalsback to summary
public String[][] getPrincipals()

Returns the Principal classes and names associated with this PrivateCredentialPermission. The information is returned as a two-dimensional array (array[x][y]). The 'x' value corresponds to the number of Principal class and name pairs. When (y==0), it corresponds to the Principal class value, and when (y==1), it corresponds to the Principal name value. For example, array[0][0] corresponds to the class name of the first Principal in the array. array[0][1] corresponds to the Principal name of the first Principal in the array.

Returns:String[][]

the Principal class and names associated with this PrivateCredentialPermission.

hashCodeback to summary
public int hashCode()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this object.

Returns:int

the hash code value for this object

Annotations
@Override
impliesback to summary
public boolean implies(Permission p)

Implements abstract java.security.Permission.implies.

Checks if this PrivateCredentialPermission implies the specified Permission.

This method returns true if:

  • p is an instanceof PrivateCredentialPermission and
  • the target name for p is 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"].
    
Parameters
p:Permission

the Permission to check against.

Returns:boolean

true if this PrivateCredentialPermission implies the specified Permission, false if not.

impliesCredentialClassback to summary
private boolean impliesCredentialClass(String thisC, String thatC)
impliesPrincipalSetback to summary
private boolean impliesPrincipalSet(PrivateCredentialPermission.CredOwner[] thisP, PrivateCredentialPermission.CredOwner[] thatP)
initback to summary
private void init(String name)
newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.Permission.newPermissionCollection.

Return a homogeneous collection of PrivateCredentialPermissions in a PermissionCollection. No such PermissionCollection is defined, so this method always returns null.

Returns:PermissionCollection

null in all cases.

readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

Reads this object from a stream (i.e., deserializes it)

Parameters
s:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
javax.security.auth back to summary

pack-priv Class PrivateCredentialPermission.CredOwner

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv String
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
CredOwner(String principalClass, String principalName)

Method Summary

Modifier and TypeMethod and Description
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

principalClassback to summary
pack-priv String principalClass
principalNameback to summary
pack-priv String principalName
serialVersionUIDback to summary
private static final long serialVersionUID
Annotations
@Serial

Constructor Detail

CredOwnerback to summary
pack-priv CredOwner(String principalClass, String principalName)

Method Detail

impliesback to summary
public boolean implies(Object obj)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object