public class PrincipalName
extends org.apache.directory.shared.asn1.AbstractAsn1Object
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 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
prinipal type.
|
Modifier and Type | Method and Description |
---|---|
void |
addName(String name)
Add a new name to the PrincipalName
|
int |
computeLength()
Compute the PrincipalName length
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)
|
...
|
ByteBuffer |
encode(ByteBuffer buffer)
Encode the PrincipalName message to a PDU.
|
List<String> |
getNames()
Returns the name components.
|
String |
getNameString() |
PrincipalNameType |
getNameType()
Returns the type of the
PrincipalName . |
void |
setNameType(int nameType)
Set the Principal name Type
|
void |
setNameType(PrincipalNameType nameType)
Set the Principal name Type
|
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 nameParseException
public PrincipalName(String nameString, int nameType) throws ParseException
nameString
- nameType
- ParseException
public PrincipalNameType getNameType()
PrincipalName
.PrincipalName
.public void setNameType(PrincipalNameType nameType)
nameType
- the Principal name Typepublic void setNameType(int nameType)
nameType
- the Principal name Typepublic String getNameString()
public void addName(String name)
name
- The name to addpublic int computeLength()
computeLength
in interface org.apache.directory.shared.asn1.Asn1Object
computeLength
in class org.apache.directory.shared.asn1.AbstractAsn1Object
public ByteBuffer encode(ByteBuffer buffer) throws org.apache.directory.shared.asn1.codec.EncoderException
encode
in interface org.apache.directory.shared.asn1.Asn1Object
encode
in class org.apache.directory.shared.asn1.AbstractAsn1Object
buffer
- The buffer where to put the PDU. It should have been allocated
before, with the right size.org.apache.directory.shared.asn1.codec.EncoderException
public String toString()
toString
in class Object
Object.toString()
Copyright © 2003–2013 The Apache Software Foundation. All rights reserved.