APIdia Launch Partner
Top Description Fields Constructors Methods
javax.security.auth.kerberos

public final Class ServicePermission

Additional top-level class in compilation unit: KrbServicePermissionCollection.

extends Permission
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@Deprecated
since:25
forRemoval:true
Imports
java.io.*, java.security.Permission, .PermissionCollection, java.util.*, java.util.concurrent.ConcurrentHashMap

Deprecated

for removal since 25.

This permission cannot be used for controlling access to resources as the Security Manager is no longer supported.

A ServicePermission contains a service principal name and a list of actions which specify the context the credential can be used within.

The service principal name is the canonical name of the KerberosPrincipal supplying the service, that is the KerberosPrincipal represents a Kerberos service principal. This name is treated in a case sensitive manner. An asterisk may appear by itself, to signify any service principal.

The possible actions are:

   initiate -              allow the caller to use the credential to
                           initiate a security context with a service
                           principal.

   accept -                allow the caller to use the credential to
                           accept security context as a particular
                           principal.
Since
1.4

Field Summary

Modifier and TypeField and Description
private static final int
ACCEPT

Accept a security context

private String
actions

the actions string.

private static final int
ALL

All actions

private static final int
INITIATE

Initiate a security context to the specified service

private transient int
private static final int
NONE

No actions.

private static final long

Constructor Summary

AccessConstructor and Description
public
ServicePermission(String
the name of the service principal. An asterisk may appear by itself, to signify any service principal.
servicePrincipal
,
String
the action string
action
)

Create a new ServicePermission with the specified servicePrincipal and action.

pack-priv
ServicePermission(String servicePrincipal, int mask)

Creates a ServicePermission object with the specified servicePrincipal and a pre-calculated mask.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if obj is a ServicePermission, and has the same service principal, and actions as this ServicePermission object.
equals
(Object
the object to test for equality with this object.
obj
)

Implements abstract java.security.Permission.equals.

Checks two ServicePermission objects for equality.

pack-priv static String

Returns:

the canonical string representation of the actions
getActions
(int
a specific integer action mask to translate into a string
mask
)

Returns the "canonical string representation" of the actions in the specified mask.

public String
getActions()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions.

pack-priv int

Returns:

the actions mask.
getMask
()

Return the current action mask.

private static int

Returns:

the action mask
getMask
(String
the action string.
action
)

Convert an action string to an integer actions mask.

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 the specified permission is implied by this object, false if not.
implies
(Permission
the permission to check against.
p
)

Implements abstract java.security.Permission.implies.

Checks if this Kerberos service permission object "implies" the specified permission.

pack-priv boolean
impliesIgnoreMask(ServicePermission p)
References Deprecated ServicePermission is deprecated or references (maybe indirectly) at least one deprecated element.

private void
init(String servicePrincipal, int mask)

Initialize the ServicePermission object.

public PermissionCollection

Returns:

a new PermissionCollection object suitable for storing ServicePermissions.
newPermissionCollection
()

Overrides java.security.Permission.newPermissionCollection.

Returns a PermissionCollection object for storing ServicePermission objects.

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

readObject is called to restore the state of the ServicePermission from a stream.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to which data is written
s
)

WriteObject is called to save the state of the ServicePermission to a stream.

Inherited from java.security.Permission:
checkGuardgetNametoString

Field Detail

ACCEPTback to summary
private static final int ACCEPT

Accept a security context

actionsback to summary
private String actions

the actions string.

ALLback to summary
private static final int ALL

All actions

INITIATEback to summary
private static final int INITIATE

Initiate a security context to the specified service

maskback to summary
private transient int mask
NONEback to summary
private static final int NONE

No actions.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Annotations
@Serial

Constructor Detail

ServicePermissionback to summary
public ServicePermission(String servicePrincipal, String action)

Create a new ServicePermission with the specified servicePrincipal and action.

Parameters
servicePrincipal:String

the name of the service principal. An asterisk may appear by itself, to signify any service principal.

action:String

the action string

ServicePermissionback to summary
pack-priv ServicePermission(String servicePrincipal, int mask)

Creates a ServicePermission object with the specified servicePrincipal and a pre-calculated mask. Avoids the overhead of re-computing the mask. Called by ServicePermissionCollection.

Method Detail

equalsback to summary
public boolean equals(Object obj)

Implements abstract java.security.Permission.equals.

Checks two ServicePermission objects for equality.

Parameters
obj:Object

the object to test for equality with this object.

Returns:boolean

true if obj is a ServicePermission, and has the same service principal, and actions as this ServicePermission object.

Annotations
@Override
getActionsback to summary
pack-priv static String getActions(int mask)

Returns the "canonical string representation" of the actions in the specified mask. Always returns present actions in the following order: initiate, accept.

Parameters
mask:int

a specific integer action mask to translate into a string

Returns:String

the canonical string representation of the actions

getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions. Always returns present actions in the following order: initiate, accept.

Annotations
@Override
getMaskback to summary
pack-priv int getMask()

Return the current action mask.

Returns:int

the actions mask.

getMaskback to summary
private static int getMask(String action)

Convert an action string to an integer actions mask.

Note

if action is "-", action will be NONE, which means any action implies it.

Parameters
action:String

the action string.

Returns:int

the action mask

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 Kerberos service permission object "implies" the specified permission.

More specifically, this method returns true if all the following are true (and returns false if any of them are not):

  • p is an instanceof ServicePermission,
  • p's actions are a proper subset of this ServicePermission's actions,
  • p's name is equal to this ServicePermission's name or this ServicePermission's name is "*".
Parameters
p:Permission

the permission to check against.

Returns:boolean

true if the specified permission is implied by this object, false if not.

Annotations
@Override
impliesIgnoreMaskback to summary
pack-priv boolean impliesIgnoreMask(ServicePermission p)

References Deprecated

ServicePermission is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

initback to summary
private void init(String servicePrincipal, int mask)

Initialize the ServicePermission object.

newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.Permission.newPermissionCollection.

Returns a PermissionCollection object for storing ServicePermission objects.
ServicePermission objects must be stored in a manner that allows them to be inserted into the collection in any order, but that also enables the PermissionCollection implies method to be implemented in an efficient (and consistent) manner.

Returns:PermissionCollection

a new PermissionCollection object suitable for storing ServicePermissions.

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

readObject is called to restore the state of the ServicePermission from a stream.

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
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException

WriteObject is called to save the state of the ServicePermission to a stream. The actions are serialized, and the superclass takes care of the name.

Parameters
s:ObjectOutputStream

the ObjectOutputStream to which data is written

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs