com.dstc.security.kerberos
Class PrincipalName

java.lang.Object
  |
  +--com.dstc.security.kerberos.PrincipalName

public final class PrincipalName
extends Object

A class representing a Kerberos principal's name. This includes a name type and a sequence of name components. Several name types have been standardized in RFC1510. Supported name types in this release are listed below.

The Kerberos principal name is defined in RFC1510 as the ASN.1 structure

   PrincipalName ::=  SEQUENCE {
                       name-type[0]     INTEGER,
                       name-string[1]   SEQUENCE OF GeneralString
                      }

 

See Also:
Kerberos

Field Summary
static int NT_PRINCIPAL
          General principal name (type 1)
static int NT_SRV_HST
          Service with host name as instance (type 3)
static int NT_SRV_INST
          Service and other unique instance (type 2)
static int NT_SRV_XHST
          Service with slash-separated host name components (type 4)
static int NT_UID
          Unique id (type 5)
static int NT_UNKNOWN
          Name type not known (type 0)
 
Constructor Summary
PrincipalName(byte[] encoded)
          Constructs a PrincipalName from its ASN.1 DER encoding
PrincipalName(int type, String name)
          Constructs a PrincipalName from a given name type and a String representation for the name, ie.
PrincipalName(int type, String[] components)
          Constructs a PrincipalName from a given name type and the name components as an array of Strings
PrincipalName(String name)
          Constructs a PrincipalName from a String representation for the name, ie.
 
Method Summary
 byte[] getEncoded()
          Returns the ASN.1 DER encoding for this PrincipalName
 String[] nameComponents()
          Returns the sequence of name components for this PrincipalName
 int nameType()
          Returns the name type of this PrincipalName
 String toString()
          Returns a String representation for this PrincipalName, which is a concatenation of the String representation for the name components separated by "/"s.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NT_UNKNOWN

public static final int NT_UNKNOWN
Name type not known (type 0)

NT_PRINCIPAL

public static final int NT_PRINCIPAL
General principal name (type 1)

NT_SRV_INST

public static final int NT_SRV_INST
Service and other unique instance (type 2)

NT_SRV_HST

public static final int NT_SRV_HST
Service with host name as instance (type 3)

NT_SRV_XHST

public static final int NT_SRV_XHST
Service with slash-separated host name components (type 4)

NT_UID

public static final int NT_UID
Unique id (type 5)
Constructor Detail

PrincipalName

public PrincipalName(String name)
Constructs a PrincipalName from a String representation for the name, ie. a concatenation of String components separated by "/"s. The name type defaults to NT_PRINCIPAL.

PrincipalName

public PrincipalName(int type,
                     String name)
Constructs a PrincipalName from a given name type and a String representation for the name, ie. a concatenation of String components separated by "/"s.

PrincipalName

public PrincipalName(int type,
                     String[] components)
Constructs a PrincipalName from a given name type and the name components as an array of Strings

PrincipalName

public PrincipalName(byte[] encoded)
              throws KerberosException
Constructs a PrincipalName from its ASN.1 DER encoding
Method Detail

nameType

public int nameType()
Returns the name type of this PrincipalName

nameComponents

public String[] nameComponents()
Returns the sequence of name components for this PrincipalName

toString

public String toString()
Returns a String representation for this PrincipalName, which is a concatenation of the String representation for the name components separated by "/"s.
Overrides:
toString in class Object

getEncoded

public byte[] getEncoded()
                  throws KerberosException
Returns the ASN.1 DER encoding for this PrincipalName