HADOOP-8346. Makes oid changes to make SPNEGO work. Was broken due to fixes introduced by the IBM JDK compatibility patch. Contributed by Devaraj Das.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1333557 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d948998777
commit
e3242b95b3
|
@ -26,7 +26,6 @@ import javax.security.auth.login.Configuration;
|
|||
import javax.security.auth.login.LoginContext;
|
||||
import javax.security.auth.login.LoginException;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.security.AccessControlContext;
|
||||
|
@ -196,11 +195,10 @@ public class KerberosAuthenticator implements Authenticator {
|
|||
try {
|
||||
GSSManager gssManager = GSSManager.getInstance();
|
||||
String servicePrincipal = "HTTP/" + KerberosAuthenticator.this.url.getHost();
|
||||
|
||||
Oid oid = KerberosUtil.getOidInstance("NT_GSS_KRB5_PRINCIPAL");
|
||||
GSSName serviceName = gssManager.createName(servicePrincipal,
|
||||
GSSName.NT_HOSTBASED_SERVICE);
|
||||
Oid oid = KerberosUtil.getOidClassInstance(servicePrincipal,
|
||||
gssManager);
|
||||
oid);
|
||||
oid = KerberosUtil.getOidInstance("GSS_KRB5_MECH_OID");
|
||||
gssContext = gssManager.createContext(serviceName, oid, null,
|
||||
GSSContext.DEFAULT_LIFETIME);
|
||||
gssContext.requestCredDeleg(true);
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import org.ietf.jgss.GSSException;
|
||||
import org.ietf.jgss.GSSManager;
|
||||
import org.ietf.jgss.Oid;
|
||||
|
||||
public class KerberosUtil {
|
||||
|
@ -34,8 +33,7 @@ public class KerberosUtil {
|
|||
: "com.sun.security.auth.module.Krb5LoginModule";
|
||||
}
|
||||
|
||||
public static Oid getOidClassInstance(String servicePrincipal,
|
||||
GSSManager gssManager)
|
||||
public static Oid getOidInstance(String oidName)
|
||||
throws ClassNotFoundException, GSSException, NoSuchFieldException,
|
||||
IllegalAccessException {
|
||||
Class<?> oidClass;
|
||||
|
@ -44,7 +42,7 @@ public class KerberosUtil {
|
|||
} else {
|
||||
oidClass = Class.forName("sun.security.jgss.GSSUtil");
|
||||
}
|
||||
Field oidField = oidClass.getDeclaredField("GSS_KRB5_MECH_OID");
|
||||
Field oidField = oidClass.getDeclaredField(oidName);
|
||||
return (Oid)oidField.get(oidClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -145,10 +145,10 @@ public class TestKerberosAuthenticationHandler extends TestCase {
|
|||
GSSContext gssContext = null;
|
||||
try {
|
||||
String servicePrincipal = KerberosTestUtils.getServerPrincipal();
|
||||
Oid oid = KerberosUtil.getOidInstance("NT_GSS_KRB5_PRINCIPAL");
|
||||
GSSName serviceName = gssManager.createName(servicePrincipal,
|
||||
GSSName.NT_HOSTBASED_SERVICE);
|
||||
Oid oid = KerberosUtil.getOidClassInstance(servicePrincipal,
|
||||
gssManager);
|
||||
oid);
|
||||
oid = KerberosUtil.getOidInstance("GSS_KRB5_MECH_OID");
|
||||
gssContext = gssManager.createContext(serviceName, oid, null,
|
||||
GSSContext.DEFAULT_LIFETIME);
|
||||
gssContext.requestCredDeleg(true);
|
||||
|
|
|
@ -409,6 +409,9 @@ Release 2.0.0 - UNRELEASED
|
|||
HADOOP-8342. HDFS command fails with exception following merge of
|
||||
HADOOP-8325 (tucu)
|
||||
|
||||
HADOOP-8346. Makes oid changes to make SPNEGO work. Was broken due
|
||||
to fixes introduced by the IBM JDK compatibility patch. (ddas)
|
||||
|
||||
BREAKDOWN OF HADOOP-7454 SUBTASKS
|
||||
|
||||
HADOOP-7455. HA: Introduce HA Service Protocol Interface. (suresh)
|
||||
|
|
Loading…
Reference in New Issue