public class KerberosUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.ietf.jgss.Oid |
GSS_KRB5_MECH_OID
Oid instance for Kerberos mechanism.
|
static org.ietf.jgss.Oid |
GSS_SPNEGO_MECH_OID
Oid instance for Kerberos spnego mechanism.
|
static org.ietf.jgss.Oid |
NT_GSS_KRB5_PRINCIPAL_OID
Oid instance for Kerberos principal name.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
doAs(javax.security.auth.Subject subject,
java.util.concurrent.Callable<T> callable)
Execute the given action as the given subject.
|
static java.lang.String |
getKrb5LoginModuleName() |
static javax.security.auth.login.LoginContext |
login(java.lang.String principal,
java.lang.String keyTabFile)
Login to KDC using principal and keytab file.
|
public static final org.ietf.jgss.Oid GSS_SPNEGO_MECH_OID
public static final org.ietf.jgss.Oid GSS_KRB5_MECH_OID
public static final org.ietf.jgss.Oid NT_GSS_KRB5_PRINCIPAL_OID
public static javax.security.auth.login.LoginContext login(java.lang.String principal, java.lang.String keyTabFile) throws javax.security.auth.login.LoginException
principal
- The principal namekeyTabFile
- The keytab filejavax.security.auth.login.LoginException
- If login fails, or if the principal and keytab file are invalid.public static <T> T doAs(javax.security.auth.Subject subject, java.util.concurrent.Callable<T> callable) throws java.lang.Exception
T
- The return type of the actionsubject
- The subject to execute the action as.callable
- The action to execute.java.lang.Exception
- If the action throws an exceptionpublic static java.lang.String getKrb5LoginModuleName()