javax.security.auth.kerberos
Class ServicePermission

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.Permission sample code for java.security.Permission definition code for java.security.Permission 
      extended by javax.security.auth.kerberos.ServicePermission
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Guard sample code for java.security.Guard definition code for java.security.Guard

public final class ServicePermission
extends Permission sample code for java.security.Permission definition code for java.security.Permission
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

This class is used to protect Kerberos services and the credentials necessary to access those services. There is a one to one mapping of a service principal and the credentials necessary to access the service. Therefore granting access to a service principal implicitly grants access to the credential necessary to establish a security context with the service principal. This applies regardless of whether the credentials are in a cache or acquired via an exchange with the KDC. The credential can be either a ticket granting ticket, a service ticket or a secret key from a key table.

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 KereberosPrincipal 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.

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:
JDK1.4
See Also:
Serialized Form

Constructor Summary
ServicePermission sample code for javax.security.auth.kerberos.ServicePermission.ServicePermission(java.lang.String, java.lang.String) definition code for javax.security.auth.kerberos.ServicePermission.ServicePermission(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  servicePrincipal, String sample code for java.lang.String definition code for java.lang.String  action)
          Create a new ServicePermission with the specified servicePrincipal and action.
 
Method Summary
 boolean equals sample code for javax.security.auth.kerberos.ServicePermission.equals(java.lang.Object) definition code for javax.security.auth.kerberos.ServicePermission.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Checks two ServicePermission objects for equality.
 String sample code for java.lang.String definition code for java.lang.String getActions sample code for javax.security.auth.kerberos.ServicePermission.getActions() definition code for javax.security.auth.kerberos.ServicePermission.getActions() ()
          Returns the canonical string representation of the actions.
 int hashCode sample code for javax.security.auth.kerberos.ServicePermission.hashCode() definition code for javax.security.auth.kerberos.ServicePermission.hashCode() ()
          Returns the hash code value for this object.
 boolean implies sample code for javax.security.auth.kerberos.ServicePermission.implies(java.security.Permission) definition code for javax.security.auth.kerberos.ServicePermission.implies(java.security.Permission) (Permission sample code for java.security.Permission definition code for java.security.Permission  p)
          Checks if this Kerberos service permission object "implies" the specified permission.
 PermissionCollection sample code for java.security.PermissionCollection definition code for java.security.PermissionCollection newPermissionCollection sample code for javax.security.auth.kerberos.ServicePermission.newPermissionCollection() definition code for javax.security.auth.kerberos.ServicePermission.newPermissionCollection() ()
          Returns a PermissionCollection object for storing ServicePermission objects.
 
Methods inherited from class java.security.Permission sample code for java.security.Permission definition code for java.security.Permission
checkGuard sample code for java.security.Permission.checkGuard(java.lang.Object) definition code for java.security.Permission.checkGuard(java.lang.Object) , getName sample code for java.security.Permission.getName() definition code for java.security.Permission.getName() , toString sample code for java.security.Permission.toString() definition code for java.security.Permission.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

ServicePermission sample code for javax.security.auth.kerberos.ServicePermission(java.lang.String, java.lang.String) definition code for javax.security.auth.kerberos.ServicePermission(java.lang.String, java.lang.String)

public ServicePermission(String sample code for java.lang.String definition code for java.lang.String  servicePrincipal,
                         String sample code for java.lang.String definition code for java.lang.String  action)
Create a new ServicePermission with the specified servicePrincipal and action.

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

action - the action string
Method Detail

implies sample code for javax.security.auth.kerberos.ServicePermission.implies(java.security.Permission) definition code for javax.security.auth.kerberos.ServicePermission.implies(java.security.Permission)

public boolean implies(Permission sample code for java.security.Permission definition code for java.security.Permission  p)
Checks if this Kerberos service permission object "implies" the specified permission.

If none of the above are true, implies returns false.

Specified by:
implies sample code for java.security.Permission.implies(java.security.Permission) definition code for java.security.Permission.implies(java.security.Permission) in class Permission sample code for java.security.Permission definition code for java.security.Permission
Parameters:
p - the permission to check against.
Returns:
true if the specified permission is implied by this object, false if not.

equals sample code for javax.security.auth.kerberos.ServicePermission.equals(java.lang.Object) definition code for javax.security.auth.kerberos.ServicePermission.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Checks two ServicePermission objects for equality.

Specified by:
equals sample code for java.security.Permission.equals(java.lang.Object) definition code for java.security.Permission.equals(java.lang.Object) in class Permission sample code for java.security.Permission definition code for java.security.Permission
Parameters:
obj - the object to test for equality with this object.
Returns:
true if obj is a ServicePermission, and has the same service principal, and actions as this ServicePermission object.
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for javax.security.auth.kerberos.ServicePermission.hashCode() definition code for javax.security.auth.kerberos.ServicePermission.hashCode()

public int hashCode()
Returns the hash code value for this object.

Specified by:
hashCode sample code for java.security.Permission.hashCode() definition code for java.security.Permission.hashCode() in class Permission sample code for java.security.Permission definition code for java.security.Permission
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

getActions sample code for javax.security.auth.kerberos.ServicePermission.getActions() definition code for javax.security.auth.kerberos.ServicePermission.getActions()

public String sample code for java.lang.String definition code for java.lang.String  getActions()
Returns the canonical string representation of the actions. Always returns present actions in the following order: initiate, accept.

Specified by:
getActions sample code for java.security.Permission.getActions() definition code for java.security.Permission.getActions() in class Permission sample code for java.security.Permission definition code for java.security.Permission
Returns:
the actions of this Permission.

newPermissionCollection sample code for javax.security.auth.kerberos.ServicePermission.newPermissionCollection() definition code for javax.security.auth.kerberos.ServicePermission.newPermissionCollection()

public PermissionCollection sample code for java.security.PermissionCollection definition code for java.security.PermissionCollection  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.

Overrides:
newPermissionCollection sample code for java.security.Permission.newPermissionCollection() definition code for java.security.Permission.newPermissionCollection() in class Permission sample code for java.security.Permission definition code for java.security.Permission
Returns:
a new PermissionCollection object suitable for storing ServicePermissions.