public class PrincipalName extends Object implements org.apache.directory.api.asn1.Asn1Object
PrincipalName ::= SEQUENCE {
name-type [0] Int32,
name-string [1] SEQUENCE OF KerberosString
}
| Constructor and Description |
|---|
PrincipalName()
Creates a new empty instance of PrincipalName.
|
PrincipalName(KerberosPrincipal principal)
Creates a new instance of PrincipalName, given a KerberosPrincipal.
|
PrincipalName(String[] nameParts,
int nameType)
Creates a new instance of PrincipalName given a String[] and an
principal type.
|
PrincipalName(String nameString,
int nameType)
Creates a new instance of PrincipalName.
|
PrincipalName(String nameString,
PrincipalNameType nameType)
Creates a new instance of PrincipalName given a String and an
principal type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addName(String name)
Add a new name to the PrincipalName
|
int |
computeLength()
Compute the PrincipalName length
|
ByteBuffer |
encode(ByteBuffer buffer)
Encode the PrincipalName message to a PDU.
|
boolean |
equals(Object obj) |
List<String> |
getNames()
Returns the name components.
|
String |
getNameString() |
PrincipalNameType |
getNameType()
Returns the type of the
PrincipalName. |
String |
getRealm()
Get the realm for the principal
|
int |
hashCode() |
void |
setNameType(int nameType)
Set the Principal name Type
|
void |
setNameType(PrincipalNameType nameType)
Set the Principal name Type
|
void |
setRealm(String realm)
Set the realm for the principal
|
String |
toString() |
public PrincipalName()
public PrincipalName(KerberosPrincipal principal)
principal - A Sun kerberosPrincipal instancepublic PrincipalName(String nameString, PrincipalNameType nameType) throws ParseException
nameString - The name string, which can contains more than one nameComponentnameType - The principal nameParseExceptionpublic PrincipalName(String[] nameParts, int nameType)
nameParts - The name string, which can contains more than one nameComponentnameType - The principal name typepublic PrincipalName(String nameString, int nameType)
nameString - nameType - public PrincipalNameType getNameType()
PrincipalName.PrincipalName.public void setNameType(PrincipalNameType nameType)
nameType - the Principal name Typepublic void setNameType(int nameType)
nameType - the Principal name Typepublic void setRealm(String realm)
realm - the realm of the principalpublic String getRealm()
public String getNameString()
public void addName(String name)
name - The name to addpublic int computeLength()
PrincipalName :
0x30 L1 PrincipalName sequence
|
+--> 0xA1 L2 name-type tag
| |
| +--> 0x02 L2-1 addressType (int)
|
+--> 0xA2 L3 name-string tag
|
+--> 0x30 L3-1 name-string (SEQUENCE OF KerberosString)
|
+--> 0x1B L4[1] value (KerberosString)
|
+--> 0x1B L4[2] value (KerberosString)
|
...
|
+--> 0x1B L4[n] value (KerberosString)
computeLength in interface org.apache.directory.api.asn1.Asn1Objectpublic ByteBuffer encode(ByteBuffer buffer) throws org.apache.directory.api.asn1.EncoderException
PrincipalName :
0x30 LL
0xA0 LL
0x02 0x01 name-type (integer)
0xA1 LL
0x30 LL name-string (SEQUENCE OF KerberosString)
0x1B LL name-string[1]
0x1B LL name-string[2]
...
0x1B LL name-string[n]
encode in interface org.apache.directory.api.asn1.Asn1Objectbuffer - The buffer where to put the PDU. It should have been allocated
before, with the right size.org.apache.directory.api.asn1.EncoderExceptionpublic String toString()
toString in class ObjectObject.toString()Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.