Package org.apache.gravitino.auth
Class KerberosUtils
java.lang.Object
org.apache.gravitino.auth.KerberosUtils
Utility class for Kerberos related tests.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TExecute the given action as the given subject.static Stringstatic LoginContextLogin to KDC using principal and keytab file.
-
Field Details
-
GSS_SPNEGO_MECH_OID
Oid instance for Kerberos spnego mechanism. -
GSS_KRB5_MECH_OID
Oid instance for Kerberos mechanism. -
NT_GSS_KRB5_PRINCIPAL_OID
Oid instance for Kerberos principal name.
-
-
Method Details
-
login
Login to KDC using principal and keytab file.- Parameters:
principal- The principal namekeyTabFile- The keytab file- Returns:
- The login context
- Throws:
LoginException- If login fails, or if the principal and keytab file are invalid.
-
doAs
Execute the given action as the given subject.- Type Parameters:
T- The return type of the action- Parameters:
subject- The subject to execute the action as.callable- The action to execute.- Returns:
- The result of the action
- Throws:
Exception- If the action throws an exception
-
getKrb5LoginModuleName
- Returns:
- The Kerberos login module name.
-