javax.security.auth.kerberos
Class KerberosTicket

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.security.auth.kerberos.KerberosTicket
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable , Refreshable sample code for javax.security.auth.Refreshable definition code for javax.security.auth.Refreshable

public class KerberosTicket
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable , Refreshable sample code for javax.security.auth.Refreshable definition code for javax.security.auth.Refreshable , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

This class encapsulates a Kerberos ticket and associated information as viewed from the client's point of view. It captures all information that the Key Distribution Center (KDC) sends to the client in the reply message KDC-REP defined in the Kerberos Protocol Specification (RFC 1510).

All Kerberos JAAS login modules that authenticate a user to a KDC should use this class. Where available, the login module might even read this information from a ticket cache in the operating system instead of directly communicating with the KDC. During the commit phase of the JAAS authentication process, the JAAS login module should instantiate this class and store the instance in the private credential set of a Subject sample code for javax.security.auth.Subject definition code for javax.security.auth.Subject .

It might be necessary for the application to be granted a PrivateCredentialPermission sample code for javax.security.auth.PrivateCredentialPermission definition code for javax.security.auth.PrivateCredentialPermission if it needs to access a KerberosTicket instance from a Subject. This permission is not needed when the application depends on the default JGSS Kerberos mechanism to access the KerberosTicket. In that case, however, the application will need an appropriate ServicePermission sample code for javax.security.auth.kerberos.ServicePermission definition code for javax.security.auth.kerberos.ServicePermission .

Note that this class is applicable to both ticket granting tickets and other regular service tickets. A ticket granting ticket is just a special case of a more generalized service ticket.

Since:
1.4
See Also:
Subject sample code for javax.security.auth.Subject definition code for javax.security.auth.Subject , PrivateCredentialPermission sample code for javax.security.auth.PrivateCredentialPermission definition code for javax.security.auth.PrivateCredentialPermission , LoginContext sample code for javax.security.auth.login.LoginContext definition code for javax.security.auth.login.LoginContext , GSSCredential sample code for org.ietf.jgss.GSSCredential definition code for org.ietf.jgss.GSSCredential , GSSManager sample code for org.ietf.jgss.GSSManager definition code for org.ietf.jgss.GSSManager , Serialized Form

Constructor Summary
KerberosTicket sample code for javax.security.auth.kerberos.KerberosTicket.KerberosTicket(byte[], javax.security.auth.kerberos.KerberosPrincipal, javax.security.auth.kerberos.KerberosPrincipal, byte[], int, boolean[], java.util.Date, java.util.Date, java.util.Date, java.util.Date, java.net.InetAddress[]) definition code for javax.security.auth.kerberos.KerberosTicket.KerberosTicket(byte[], javax.security.auth.kerberos.KerberosPrincipal, javax.security.auth.kerberos.KerberosPrincipal, byte[], int, boolean[], java.util.Date, java.util.Date, java.util.Date, java.util.Date, java.net.InetAddress[]) (byte[] asn1Encoding, KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal  client, KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal  server, byte[] sessionKey, int keyType, boolean[] flags, Date sample code for java.util.Date definition code for java.util.Date  authTime, Date sample code for java.util.Date definition code for java.util.Date  startTime, Date sample code for java.util.Date definition code for java.util.Date  endTime, Date sample code for java.util.Date definition code for java.util.Date  renewTill, InetAddress sample code for java.net.InetAddress definition code for java.net.InetAddress [] clientAddresses)
          Constructs a KerberosTicket using credentials information that a client either receives from a KDC or reads from a cache.
 
Method Summary
 void destroy sample code for javax.security.auth.kerberos.KerberosTicket.destroy() definition code for javax.security.auth.kerberos.KerberosTicket.destroy() ()
          Destroys the ticket and destroys any sensitive information stored in it.
 Date sample code for java.util.Date definition code for java.util.Date getAuthTime sample code for javax.security.auth.kerberos.KerberosTicket.getAuthTime() definition code for javax.security.auth.kerberos.KerberosTicket.getAuthTime() ()
          Returns the time that the client was authenticated.
 KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal getClient sample code for javax.security.auth.kerberos.KerberosTicket.getClient() definition code for javax.security.auth.kerberos.KerberosTicket.getClient() ()
          Returns the client principal associated with this ticket.
 InetAddress sample code for java.net.InetAddress definition code for java.net.InetAddress [] getClientAddresses sample code for javax.security.auth.kerberos.KerberosTicket.getClientAddresses() definition code for javax.security.auth.kerberos.KerberosTicket.getClientAddresses() ()
          Returns a list of addresses from where the ticket can be used.
 byte[] getEncoded sample code for javax.security.auth.kerberos.KerberosTicket.getEncoded() definition code for javax.security.auth.kerberos.KerberosTicket.getEncoded() ()
          Returns an ASN.1 encoding of the entire ticket.
 Date sample code for java.util.Date definition code for java.util.Date getEndTime sample code for javax.security.auth.kerberos.KerberosTicket.getEndTime() definition code for javax.security.auth.kerberos.KerberosTicket.getEndTime() ()
          Returns the expiration time for this ticket's validity period.
 boolean[] getFlags sample code for javax.security.auth.kerberos.KerberosTicket.getFlags() definition code for javax.security.auth.kerberos.KerberosTicket.getFlags() ()
          Returns the flags associated with this ticket.
 Date sample code for java.util.Date definition code for java.util.Date getRenewTill sample code for javax.security.auth.kerberos.KerberosTicket.getRenewTill() definition code for javax.security.auth.kerberos.KerberosTicket.getRenewTill() ()
          Returns the latest expiration time for this ticket, including all renewals.
 KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal getServer sample code for javax.security.auth.kerberos.KerberosTicket.getServer() definition code for javax.security.auth.kerberos.KerberosTicket.getServer() ()
          Returns the service principal associated with this ticket.
 javax.crypto.SecretKey getSessionKey sample code for javax.security.auth.kerberos.KerberosTicket.getSessionKey() definition code for javax.security.auth.kerberos.KerberosTicket.getSessionKey() ()
          Returns the session key associated with this ticket.
 int getSessionKeyType sample code for javax.security.auth.kerberos.KerberosTicket.getSessionKeyType() definition code for javax.security.auth.kerberos.KerberosTicket.getSessionKeyType() ()
          Returns the key type of the session key associated with this ticket as defined by the Kerberos Protocol Specification.
 Date sample code for java.util.Date definition code for java.util.Date getStartTime sample code for javax.security.auth.kerberos.KerberosTicket.getStartTime() definition code for javax.security.auth.kerberos.KerberosTicket.getStartTime() ()
          Returns the start time for this ticket's validity period.
 boolean isCurrent sample code for javax.security.auth.kerberos.KerberosTicket.isCurrent() definition code for javax.security.auth.kerberos.KerberosTicket.isCurrent() ()
          Determines if this ticket is still current.
 boolean isDestroyed sample code for javax.security.auth.kerberos.KerberosTicket.isDestroyed() definition code for javax.security.auth.kerberos.KerberosTicket.isDestroyed() ()
          Determines if this ticket has been destroyed.
 boolean isForwardable sample code for javax.security.auth.kerberos.KerberosTicket.isForwardable() definition code for javax.security.auth.kerberos.KerberosTicket.isForwardable() ()
          Determines if this ticket is forwardable.
 boolean isForwarded sample code for javax.security.auth.kerberos.KerberosTicket.isForwarded() definition code for javax.security.auth.kerberos.KerberosTicket.isForwarded() ()
          Determines if this ticket had been forwarded or was issued based on authentication involving a forwarded ticket-granting ticket.
 boolean isInitial sample code for javax.security.auth.kerberos.KerberosTicket.isInitial() definition code for javax.security.auth.kerberos.KerberosTicket.isInitial() ()
          Determines if this ticket was issued using the Kerberos AS-Exchange protocol, and not issued based on some ticket-granting ticket.
 boolean isPostdated sample code for javax.security.auth.kerberos.KerberosTicket.isPostdated() definition code for javax.security.auth.kerberos.KerberosTicket.isPostdated() ()
          Determines is this ticket is post-dated.
 boolean isProxiable sample code for javax.security.auth.kerberos.KerberosTicket.isProxiable() definition code for javax.security.auth.kerberos.KerberosTicket.isProxiable() ()
          Determines if this ticket is proxiable.
 boolean isProxy sample code for javax.security.auth.kerberos.KerberosTicket.isProxy() definition code for javax.security.auth.kerberos.KerberosTicket.isProxy() ()
          Determines is this ticket is a proxy-ticket.
 boolean isRenewable sample code for javax.security.auth.kerberos.KerberosTicket.isRenewable() definition code for javax.security.auth.kerberos.KerberosTicket.isRenewable() ()
          Determines is this ticket is renewable.
 void refresh sample code for javax.security.auth.kerberos.KerberosTicket.refresh() definition code for javax.security.auth.kerberos.KerberosTicket.refresh() ()
          Extends the validity period of this ticket.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.security.auth.kerberos.KerberosTicket.toString() definition code for javax.security.auth.kerberos.KerberosTicket.toString() ()
          Returns a string representation of the object.
 
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() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , 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() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , 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

KerberosTicket sample code for javax.security.auth.kerberos.KerberosTicket(byte[], javax.security.auth.kerberos.KerberosPrincipal, javax.security.auth.kerberos.KerberosPrincipal, byte[], int, boolean[], java.util.Date, java.util.Date, java.util.Date, java.util.Date, java.net.InetAddress[]) definition code for javax.security.auth.kerberos.KerberosTicket(byte[], javax.security.auth.kerberos.KerberosPrincipal, javax.security.auth.kerberos.KerberosPrincipal, byte[], int, boolean[], java.util.Date, java.util.Date, java.util.Date, java.util.Date, java.net.InetAddress[])

public KerberosTicket(byte[] asn1Encoding,
                      KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal  client,
                      KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal  server,
                      byte[] sessionKey,
                      int keyType,
                      boolean[] flags,
                      Date sample code for java.util.Date definition code for java.util.Date  authTime,
                      Date sample code for java.util.Date definition code for java.util.Date  startTime,
                      Date sample code for java.util.Date definition code for java.util.Date  endTime,
                      Date sample code for java.util.Date definition code for java.util.Date  renewTill,
                      InetAddress sample code for java.net.InetAddress definition code for java.net.InetAddress [] clientAddresses)
Constructs a KerberosTicket using credentials information that a client either receives from a KDC or reads from a cache.

Parameters:
asn1Encoding - the ASN.1 encoding of the ticket as defined by the Kerberos protocol specification.
client - the client that owns this service ticket
server - the service that this ticket is for
sessionKey - the raw bytes for the session key that must be used to encrypt the authenticator that will be sent to the server
keyType - the key type for the session key as defined by the Kerberos protocol specification.
flags - the ticket flags. Each element in this array indicates the value for the corresponding bit in the ASN.1 BitString that represents the ticket flags. If the number of elements in this array is less than the number of flags used by the Kerberos protocol, then the missing flags will be filled in with false.
authTime - the time of initial authentication for the client
startTime - the time after which the ticket will be valid. This may be null in which case the value of authTime is treated as the startTime.
endTime - the time after which the ticket will no longer be valid
renewTill - an absolute expiration time for the ticket, including all renewal that might be possible. This field may be null for tickets that are not renewable.
clientAddresses - the addresses from where the ticket may be used by the client. This field may be null when the ticket is usable from any address.
Method Detail

getClient sample code for javax.security.auth.kerberos.KerberosTicket.getClient() definition code for javax.security.auth.kerberos.KerberosTicket.getClient()

public final KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal  getClient()
Returns the client principal associated with this ticket.

Returns:
the client principal.

getServer sample code for javax.security.auth.kerberos.KerberosTicket.getServer() definition code for javax.security.auth.kerberos.KerberosTicket.getServer()

public final KerberosPrincipal sample code for javax.security.auth.kerberos.KerberosPrincipal definition code for javax.security.auth.kerberos.KerberosPrincipal  getServer()
Returns the service principal associated with this ticket.

Returns:
the service principal.

getSessionKey sample code for javax.security.auth.kerberos.KerberosTicket.getSessionKey() definition code for javax.security.auth.kerberos.KerberosTicket.getSessionKey()

public final javax.crypto.SecretKey getSessionKey()
Returns the session key associated with this ticket.

Returns:
the session key.

getSessionKeyType sample code for javax.security.auth.kerberos.KerberosTicket.getSessionKeyType() definition code for javax.security.auth.kerberos.KerberosTicket.getSessionKeyType()

public final int getSessionKeyType()
Returns the key type of the session key associated with this ticket as defined by the Kerberos Protocol Specification.

Returns:
the key type of the session key associated with this ticket.
See Also:
getSessionKey() sample code for javax.security.auth.kerberos.KerberosTicket.getSessionKey() definition code for javax.security.auth.kerberos.KerberosTicket.getSessionKey()

isForwardable sample code for javax.security.auth.kerberos.KerberosTicket.isForwardable() definition code for javax.security.auth.kerberos.KerberosTicket.isForwardable()

public final boolean isForwardable()
Determines if this ticket is forwardable.

Returns:
true if this ticket is forwardable, false if not.

isForwarded sample code for javax.security.auth.kerberos.KerberosTicket.isForwarded() definition code for javax.security.auth.kerberos.KerberosTicket.isForwarded()

public final boolean isForwarded()
Determines if this ticket had been forwarded or was issued based on authentication involving a forwarded ticket-granting ticket.

Returns:
true if this ticket had been forwarded or was issued based on authentication involving a forwarded ticket-granting ticket, false otherwise.

isProxiable sample code for javax.security.auth.kerberos.KerberosTicket.isProxiable() definition code for javax.security.auth.kerberos.KerberosTicket.isProxiable()

public final boolean isProxiable()
Determines if this ticket is proxiable.

Returns:
true if this ticket is proxiable, false if not.

isProxy sample code for javax.security.auth.kerberos.KerberosTicket.isProxy() definition code for javax.security.auth.kerberos.KerberosTicket.isProxy()

public final boolean isProxy()
Determines is this ticket is a proxy-ticket.

Returns:
true if this ticket is a proxy-ticket, false if not.

isPostdated sample code for javax.security.auth.kerberos.KerberosTicket.isPostdated() definition code for javax.security.auth.kerberos.KerberosTicket.isPostdated()

public final boolean isPostdated()
Determines is this ticket is post-dated.

Returns:
true if this ticket is post-dated, false if not.

isRenewable sample code for javax.security.auth.kerberos.KerberosTicket.isRenewable() definition code for javax.security.auth.kerberos.KerberosTicket.isRenewable()

public final boolean isRenewable()
Determines is this ticket is renewable. If so, the refresh sample code for javax.security.auth.kerberos.KerberosTicket.refresh() definition code for javax.security.auth.kerberos.KerberosTicket.refresh() method can be called, assuming the validity period for renewing is not already over.

Returns:
true if this ticket is renewable, false if not.

isInitial sample code for javax.security.auth.kerberos.KerberosTicket.isInitial() definition code for javax.security.auth.kerberos.KerberosTicket.isInitial()

public final boolean isInitial()
Determines if this ticket was issued using the Kerberos AS-Exchange protocol, and not issued based on some ticket-granting ticket.

Returns:
true if this ticket was issued using the Kerberos AS-Exchange protocol, false if not.

getFlags sample code for javax.security.auth.kerberos.KerberosTicket.getFlags() definition code for javax.security.auth.kerberos.KerberosTicket.getFlags()

public final boolean[] getFlags()
Returns the flags associated with this ticket. Each element in the returned array indicates the value for the corresponding bit in the ASN.1 BitString that represents the ticket flags.

Returns:
the flags associated with this ticket.

getAuthTime sample code for javax.security.auth.kerberos.KerberosTicket.getAuthTime() definition code for javax.security.auth.kerberos.KerberosTicket.getAuthTime()

public final Date sample code for java.util.Date definition code for java.util.Date  getAuthTime()
Returns the time that the client was authenticated.

Returns:
the time that the client was authenticated.

getStartTime sample code for javax.security.auth.kerberos.KerberosTicket.getStartTime() definition code for javax.security.auth.kerberos.KerberosTicket.getStartTime()

public final Date sample code for java.util.Date definition code for java.util.Date  getStartTime()
Returns the start time for this ticket's validity period.

Returns:
the start time for this ticket's validity period.

getEndTime sample code for javax.security.auth.kerberos.KerberosTicket.getEndTime() definition code for javax.security.auth.kerberos.KerberosTicket.getEndTime()

public final Date sample code for java.util.Date definition code for java.util.Date  getEndTime()
Returns the expiration time for this ticket's validity period.

Returns:
the expiration time for this ticket's validity period.

getRenewTill sample code for javax.security.auth.kerberos.KerberosTicket.getRenewTill() definition code for javax.security.auth.kerberos.KerberosTicket.getRenewTill()

public final Date sample code for java.util.Date definition code for java.util.Date  getRenewTill()
Returns the latest expiration time for this ticket, including all renewals. This will return a null value for non-renewable tickets.

Returns:
the latest expiration time for this ticket.

getClientAddresses sample code for javax.security.auth.kerberos.KerberosTicket.getClientAddresses() definition code for javax.security.auth.kerberos.KerberosTicket.getClientAddresses()

public final InetAddress sample code for java.net.InetAddress definition code for java.net.InetAddress [] getClientAddresses()
Returns a list of addresses from where the ticket can be used.

Returns:
ths list of addresses or null, if the field was not provided.

getEncoded sample code for javax.security.auth.kerberos.KerberosTicket.getEncoded() definition code for javax.security.auth.kerberos.KerberosTicket.getEncoded()

public final byte[] getEncoded()
Returns an ASN.1 encoding of the entire ticket.

Returns:
an ASN.1 encoding of the entire ticket.

isCurrent sample code for javax.security.auth.kerberos.KerberosTicket.isCurrent() definition code for javax.security.auth.kerberos.KerberosTicket.isCurrent()

public boolean isCurrent()
Determines if this ticket is still current.

Specified by:
isCurrent sample code for javax.security.auth.Refreshable.isCurrent() definition code for javax.security.auth.Refreshable.isCurrent() in interface Refreshable sample code for javax.security.auth.Refreshable definition code for javax.security.auth.Refreshable
Returns:
true if this Object is currently current, false otherwise.

refresh sample code for javax.security.auth.kerberos.KerberosTicket.refresh() definition code for javax.security.auth.kerberos.KerberosTicket.refresh()

public void refresh()
             throws RefreshFailedException sample code for javax.security.auth.RefreshFailedException definition code for javax.security.auth.RefreshFailedException 
Extends the validity period of this ticket. The ticket will contain a new session key if the refresh operation succeeds. The refresh operation will fail if the ticket is not renewable or the latest allowable renew time has passed. Any other error returned by the KDC will also cause this method to fail. Note: This method is not synchronized with the the accessor methods of this object. Hence callers need to be aware of multiple threads that might access this and try to renew it at the same time.

Specified by:
refresh sample code for javax.security.auth.Refreshable.refresh() definition code for javax.security.auth.Refreshable.refresh() in interface Refreshable sample code for javax.security.auth.Refreshable definition code for javax.security.auth.Refreshable
Throws:
RefreshFailedException sample code for javax.security.auth.RefreshFailedException definition code for javax.security.auth.RefreshFailedException - if the ticket is not renewable, or the latest allowable renew time has passed, or the KDC returns some error.
See Also:
isRenewable() sample code for javax.security.auth.kerberos.KerberosTicket.isRenewable() definition code for javax.security.auth.kerberos.KerberosTicket.isRenewable() , getRenewTill() sample code for javax.security.auth.kerberos.KerberosTicket.getRenewTill() definition code for javax.security.auth.kerberos.KerberosTicket.getRenewTill()

destroy sample code for javax.security.auth.kerberos.KerberosTicket.destroy() definition code for javax.security.auth.kerberos.KerberosTicket.destroy()

public void destroy()
             throws DestroyFailedException sample code for javax.security.auth.DestroyFailedException definition code for javax.security.auth.DestroyFailedException 
Destroys the ticket and destroys any sensitive information stored in it.

Specified by:
destroy sample code for javax.security.auth.Destroyable.destroy() definition code for javax.security.auth.Destroyable.destroy() in interface Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable
Throws:
DestroyFailedException sample code for javax.security.auth.DestroyFailedException definition code for javax.security.auth.DestroyFailedException - if the destroy operation fails.


isDestroyed sample code for javax.security.auth.kerberos.KerberosTicket.isDestroyed() definition code for javax.security.auth.kerberos.KerberosTicket.isDestroyed()

public boolean isDestroyed()
Determines if this ticket has been destroyed.

Specified by:
isDestroyed sample code for javax.security.auth.Destroyable.isDestroyed() definition code for javax.security.auth.Destroyable.isDestroyed() in interface Destroyable sample code for javax.security.auth.Destroyable definition code for javax.security.auth.Destroyable
Returns:
true if this Object has been destroyed, false otherwise.

toString sample code for javax.security.auth.kerberos.KerberosTicket.toString() definition code for javax.security.auth.kerberos.KerberosTicket.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Description copied from class: Object sample code for java.lang.Object.toString() definition code for java.lang.Object.toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of the object.