Class KerberosName
java.lang.Object
org.apache.hadoop.security.authentication.util.KerberosName
This class implements parsing and handling of Kerberos principal names. In
particular, it splits them apart and translates them down into local
operating system names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKerberosName(String name) Create a name from the full Kerberos principal name. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet the configured default realm.Get the second component of the name.getRealm()Get the realm of the name.static StringGet the rule evaluation mechanismstatic StringgetRules()Get the rules.Get the first component of the name.Get the translation of the principal name into an operating system user name.static booleanIndicates of the rule mechanism has been setstatic booleanIndicates if the name rules have been set.static voidstatic voidsetRuleMechanism(String ruleMech) static voidSet the rules.toString()Put the name back together from the parts.
-
Field Details
-
MECHANISM_HADOOP
Constant that defines auth_to_local legacy hadoop evaluation- See Also:
-
MECHANISM_MIT
Constant that defines auth_to_local MIT evaluation- See Also:
-
DEFAULT_MECHANISM
Constant that defines the default behavior of the rule mechanism- See Also:
-
-
Constructor Details
-
KerberosName
Create a name from the full Kerberos principal name.- Parameters:
name- full Kerberos principal name.
-
-
Method Details
-
resetDefaultRealm
@VisibleForTesting public static void resetDefaultRealm() -
getDefaultRealm
Get the configured default realm. Used syncronized method here, because double-check locking is overhead.- Returns:
- the default realm from the krb5.conf
-
toString
Put the name back together from the parts. -
getServiceName
Get the first component of the name.- Returns:
- the first section of the Kerberos principal name
-
getHostName
Get the second component of the name.- Returns:
- the second section of the Kerberos principal name, and may be null
-
getRealm
Get the realm of the name.- Returns:
- the realm of the name, may be null
-
getShortName
Get the translation of the principal name into an operating system user name.- Returns:
- the short name
- Throws:
IOException- throws if something is wrong with the rules
-
getRules
Get the rules.- Returns:
- String of configured rules, or null if not yet configured
-
hasRulesBeenSet
public static boolean hasRulesBeenSet()Indicates if the name rules have been set.- Returns:
- if the name rules have been set.
-
hasRuleMechanismBeenSet
public static boolean hasRuleMechanismBeenSet()Indicates of the rule mechanism has been set- Returns:
- if the rule mechanism has been set.
-
setRules
Set the rules.- Parameters:
ruleString- the rules string.
-
setRuleMechanism
- Parameters:
ruleMech- the evaluation type: hadoop, mit 'hadoop' indicates '@' or '/' are not allowed the result evaluation. 'MIT' indicates that auth_to_local rules follow MIT Kerberos evaluation.
-
getRuleMechanism
Get the rule evaluation mechanism- Returns:
- the rule evaluation mechanism
-