- All Implemented Interfaces:
- Serializable,- Guard
public final class ServicePermission extends Permission implements Serializable
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.
 
Granting this permission implies that the caller can use a cached credential (TGT, service ticket or secret key) within the context designated by the action. In the case of the TGT, granting this permission also implies that the TGT can be obtained by an Authentication Service exchange.
 Granting this permission also implies creating KerberosPrincipal
 or GSSName without providing a Kerberos
 realm, as long as the permission's service principal is in this realm.
 
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.
 
 For example, to specify the permission to access to the TGT to
 initiate a security context the permission is constructed as follows:
 
     ServicePermission("krbtgt/EXAMPLE.COM@EXAMPLE.COM", "initiate");
 
 To obtain a service ticket to initiate a context with the "host" service the permission is constructed as follows:
     ServicePermission("host/foo.example.com@EXAMPLE.COM", "initiate");
 
 For a Kerberized server the action is "accept". For example, the permission necessary to access and use the secret key of the Kerberized "host" service (telnet and the likes) would be constructed as follows:
     ServicePermission("host/foo.example.com@EXAMPLE.COM", "accept");
 - Since:
- 1.4
- See Also:
- Serialized Form
- 
Constructor SummaryConstructors Constructor Description ServicePermission(String servicePrincipal, String action)Create a newServicePermissionwith the specifiedservicePrincipalandaction.
- 
Method SummaryModifier and Type Method Description booleanequals(Object obj)Checks two ServicePermission objects for equality.StringgetActions()Returns the canonical string representation of the actions.inthashCode()Returns the hash code value for this object.booleanimplies(Permission p)Checks if this Kerberos service permission object "implies" the specified permission.PermissionCollectionnewPermissionCollection()Returns a PermissionCollection object for storing ServicePermission objects.
- 
Constructor Details- 
ServicePermissionCreate a newServicePermissionwith the specifiedservicePrincipalandaction.- Parameters:
- servicePrincipal- the name of the service principal. An asterisk may appear by itself, to signify any service principal.
- action- the action string
 
 
- 
- 
Method Details- 
impliesChecks if this Kerberos service permission object "implies" the specified permission.More specifically, this method returns true if all of 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 thisServicePermission's name is "*".
 - Specified by:
- impliesin class- Permission
- Parameters:
- p- the permission to check against.
- Returns:
- true if the specified permission is implied by this object, false if not.
 
-  p is an instanceof 
- 
equalsChecks two ServicePermission objects for equality.- Specified by:
- equalsin class- Permission
- Parameters:
- obj- the object to test for equality with this object.
- Returns:
- true if objis a ServicePermission, and has the same service principal, and actions as this ServicePermission object.
- See Also:
- Object.hashCode(),- HashMap
 
- 
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:
- Object.equals(java.lang.Object),- System.identityHashCode(java.lang.Object)
 
- 
getActionsReturns the canonical string representation of the actions. Always returns present actions in the following order: initiate, accept.- Specified by:
- getActionsin class- Permission
- Returns:
- the actions of this Permission.
 
- 
newPermissionCollectionReturns 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.- Overrides:
- newPermissionCollectionin class- Permission
- Returns:
- a new PermissionCollection object suitable for storing ServicePermissions.
 
 
-