public class PrincipalName
extends java.lang.Object
implements org.apache.directory.api.asn1.Asn1Object
PrincipalName ::= SEQUENCE {
name-type [0] Int32,
name-string [1] SEQUENCE OF KerberosString
}
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
IS_DEBUG
Speedup for logs
|
private static org.slf4j.Logger |
LOG
The logger
|
private java.util.List<byte[]> |
nameBytes
The principal name as a byte[], for encoding purpose
|
private java.util.List<java.lang.String> |
nameString
The principal name - we may have more than one -
|
private PrincipalNameType |
nameType
The type for this principal
|
private int |
principalNameSeqLength |
private int |
principalStringsSeqLength |
private int |
principalStringsTagLength |
private int |
principalTypeLength |
private int |
principalTypeTagLength |
private java.lang.String |
realm
The realm part
|
| Constructor and Description |
|---|
PrincipalName()
Creates a new empty instance of PrincipalName.
|
PrincipalName(javax.security.auth.kerberos.KerberosPrincipal principal)
Creates a new instance of PrincipalName, given a KerberosPrincipal.
|
PrincipalName(java.lang.String[] nameParts,
int nameType)
Creates a new instance of PrincipalName given a String[] and an
principal type.
|
PrincipalName(java.lang.String nameString,
int nameType)
Creates a new instance of PrincipalName.
|
PrincipalName(java.lang.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(java.lang.String name)
Add a new name to the PrincipalName
|
int |
computeLength()
Compute the PrincipalName length
|
java.nio.ByteBuffer |
encode(java.nio.ByteBuffer buffer)
Encode the PrincipalName message to a PDU.
|
boolean |
equals(java.lang.Object obj) |
java.util.List<java.lang.String> |
getNames()
Returns the name components.
|
java.lang.String |
getNameString() |
PrincipalNameType |
getNameType()
Returns the type of the
PrincipalName. |
java.lang.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(java.lang.String realm)
Set the realm for the principal
|
java.lang.String |
toString() |
private static final org.slf4j.Logger LOG
private static final boolean IS_DEBUG
private PrincipalNameType nameType
private java.util.List<java.lang.String> nameString
private java.lang.String realm
private java.util.List<byte[]> nameBytes
private int principalNameSeqLength
private int principalTypeTagLength
private int principalTypeLength
private int principalStringsTagLength
private int principalStringsSeqLength
public PrincipalName()
public PrincipalName(javax.security.auth.kerberos.KerberosPrincipal principal)
principal - A Sun kerberosPrincipal instancepublic PrincipalName(java.lang.String nameString,
PrincipalNameType nameType)
throws java.text.ParseException
nameString - The name string, which can contains more than one nameComponentnameType - The principal namejava.text.ParseExceptionpublic PrincipalName(java.lang.String[] nameParts,
int nameType)
nameParts - The name string, which can contains more than one nameComponentnameType - The principal name typepublic PrincipalName(java.lang.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(java.lang.String realm)
realm - the realm of the principalpublic java.lang.String getRealm()
public java.util.List<java.lang.String> getNames()
public java.lang.String getNameString()
public void addName(java.lang.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 java.nio.ByteBuffer encode(java.nio.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 java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object