Package org.apache.pulsar.common.sasl
Class KerberosName
- java.lang.Object
-
- org.apache.pulsar.common.sasl.KerberosName
-
public class KerberosName extends java.lang.ObjectThis class implements parsing and handling of Kerberos principal names. In particular, it splits them apart and translates them down into local operating system names.Copied from Apache ZooKeeper KerberosName.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKerberosName.BadFormatStringstatic classKerberosName.NoMatchingRule
-
Constructor Summary
Constructors Constructor Description KerberosName(java.lang.String name)Create a name from the full Kerberos principal name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDefaultRealm()Get the configured default realm.static java.lang.StringgetDefaultRealm2()java.lang.StringgetHostName()Get the second component of the name.java.lang.StringgetRealm()Get the realm of the name.java.lang.StringgetServiceName()Get the first component of the name.java.lang.StringgetShortName()Get the translation of the principal name into an operating system user name.static voidmain(java.lang.String[] args)static voidsetConfiguration()Set the static configuration to get the rules.java.lang.StringtoString()Put the name back together from the parts.
-
-
-
Method Detail
-
getDefaultRealm2
public static java.lang.String getDefaultRealm2() throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException- Throws:
java.lang.ClassNotFoundExceptionjava.lang.NoSuchMethodExceptionjava.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
getDefaultRealm
public java.lang.String getDefaultRealm()
Get the configured default realm.- Returns:
- the default realm from the krb5.conf
-
toString
public java.lang.String toString()
Put the name back together from the parts.- Overrides:
toStringin classjava.lang.Object
-
getServiceName
public java.lang.String getServiceName()
Get the first component of the name.- Returns:
- the first section of the Kerberos principal name
-
getHostName
public java.lang.String getHostName()
Get the second component of the name.- Returns:
- the second section of the Kerberos principal name, and may be null
-
getRealm
public java.lang.String getRealm()
Get the realm of the name.- Returns:
- the realm of the name, may be null
-
setConfiguration
public static void setConfiguration() throws java.io.IOExceptionSet the static configuration to get the rules.- Throws:
java.io.IOException
-
getShortName
public java.lang.String getShortName() throws java.io.IOExceptionGet the translation of the principal name into an operating system user name.- Returns:
- the short name
- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-