Class PrivateCredentialPermission
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"}*
- API Note:
- This permission cannot be used for controlling access to resources as the Security Manager is no longer supported.
- Since:
- 1.4
- See Also:
-
Constructor Summary
ConstructorDescriptionPrivateCredentialPermission
(String name, String actions) Creates a newPrivateCredentialPermission
with the specifiedname
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks twoPrivateCredentialPermission
objects for equality.Returns the "canonical string representation" of the actions.Returns the Class name of the Credential associated with thisPrivateCredentialPermission
.String[][]
Returns thePrincipal
classes and names associated with thisPrivateCredentialPermission
.int
hashCode()
Returns the hash code value for this object.boolean
Checks if thisPrivateCredentialPermission
implies the specifiedPermission
.Return a homogeneous collection of PrivateCredentialPermissions in aPermissionCollection
.Methods declared in class java.security.Permission
checkGuard, getName, toString
-
Constructor Details
-
PrivateCredentialPermission
Creates a newPrivateCredentialPermission
with the specifiedname
. Thename
specifies both a Credential class and aPrincipal
Set.- Parameters:
name
- the name specifying the Credential class andPrincipal
Set.actions
- the actions specifying that the Credential can be read.- Throws:
IllegalArgumentException
- ifname
does not conform to the correct syntax or ifactions
is not "read".
-
-
Method Details
-
getCredentialClass
Returns the Class name of the Credential associated with thisPrivateCredentialPermission
.- Returns:
- the Class name of the Credential associated with this
PrivateCredentialPermission
.
-
getPrincipals
Returns thePrincipal
classes and names associated with thisPrivateCredentialPermission
. The information is returned as a two-dimensional array (array[x][y]). The 'x' value corresponds to the number ofPrincipal
class and name pairs. When (y==0), it corresponds to thePrincipal
class value, and when (y==1), it corresponds to thePrincipal
name value. For example, array[0][0] corresponds to the class name of the firstPrincipal
in the array. array[0][1] corresponds to thePrincipal
name of the firstPrincipal
in the array.- Returns:
- the
Principal
class and names associated with thisPrivateCredentialPermission
.
-
implies
Checks if thisPrivateCredentialPermission
implies the specifiedPermission
.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"].
- Specified by:
implies
in classPermission
- Parameters:
p
- thePermission
to check against.- Returns:
- true if this
PrivateCredentialPermission
implies the specifiedPermission
, false if not.
-
-
equals
Checks twoPrivateCredentialPermission
objects for equality. Checks thatobj
is 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:
equals
in classPermission
- 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:
-
hashCode
public int hashCode()Returns the hash code value for this object.- Specified by:
hashCode
in classPermission
- Returns:
- the hash code value for this object
- See Also:
-
getActions
Returns the "canonical string representation" of the actions. This method always returns the String, "read".- Specified by:
getActions
in classPermission
- Returns:
- the actions (always returns "read").
-
newPermissionCollection
Return a homogeneous collection of PrivateCredentialPermissions in aPermissionCollection
. No suchPermissionCollection
is defined, so this method always returnsnull
.- Overrides:
newPermissionCollection
in classPermission
- Returns:
- null in all cases.
-