[36/50] [abbrv] hadoop git commit: Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar."
Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar." This reverts commit 332269de065d0f40eb54ee5e53b765217c24081e. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1f20f432 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1f20f432 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1f20f432 Branch: refs/heads/HDFS-7240 Commit: 1f20f432d2472f92797ea01711ca4cc97e7b2b23 Parents: f20dc0d Author: Xiao ChenAuthored: Wed Feb 14 10:22:37 2018 -0800 Committer: Xiao Chen Committed: Wed Feb 14 10:25:05 2018 -0800 -- .../client/KerberosAuthenticator.java | 80 +++- .../client/TestKerberosAuthenticator.java | 29 --- 2 files changed, 27 insertions(+), 82 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f20f432/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java -- diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java index 64d4330..942d13c 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java @@ -13,8 +13,6 @@ */ package org.apache.hadoop.security.authentication.client; -import com.google.common.annotations.VisibleForTesting; -import java.lang.reflect.Constructor; import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.security.authentication.server.HttpConstants; import org.apache.hadoop.security.authentication.util.AuthToken; @@ -179,62 +177,38 @@ public class KerberosAuthenticator implements Authenticator { */ @Override public void authenticate(URL url, AuthenticatedURL.Token token) - throws IOException, AuthenticationException { +throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0); - try { -HttpURLConnection conn = token.openConnection(url, connConfigurator); -conn.setRequestMethod(AUTH_HTTP_METHOD); -conn.connect(); - -boolean needFallback = false; -if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { - LOG.debug("JDK performed authentication on our behalf."); - // If the JDK already did the SPNEGO back-and-forth for - // us, just pull out the token. - AuthenticatedURL.extractToken(conn, token); - if (isTokenKerberos(token)) { -return; - } - needFallback = true; + HttpURLConnection conn = token.openConnection(url, connConfigurator); + conn.setRequestMethod(AUTH_HTTP_METHOD); + conn.connect(); + + boolean needFallback = false; + if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { +LOG.debug("JDK performed authentication on our behalf."); +// If the JDK already did the SPNEGO back-and-forth for +// us, just pull out the token. +AuthenticatedURL.extractToken(conn, token); +if (isTokenKerberos(token)) { + return; } -if (!needFallback && isNegotiate(conn)) { - LOG.debug("Performing our own SPNEGO sequence."); - doSpnegoSequence(token); -} else { - LOG.debug("Using fallback authenticator sequence."); - Authenticator auth = getFallBackAuthenticator(); - // Make sure that the fall back authenticator have the same - // ConnectionConfigurator, since the method might be overridden. - // Otherwise the fall back authenticator might not have the - // information to make the connection (e.g., SSL certificates) - auth.setConnectionConfigurator(connConfigurator); - auth.authenticate(url, token); -} - } catch (IOException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); - } catch (AuthenticationException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); +needFallback = true; + } + if (!needFallback && isNegotiate(conn)) { +LOG.debug("Performing our own SPNEGO sequence."); +doSpnegoSequence(token); + } else { +LOG.debug("Using fallback authenticator sequence."); +
hadoop git commit: Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar."
Repository: hadoop Updated Branches: refs/heads/branch-3.1 401a0ee38 -> 562274a20 Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar." This reverts commit e88265ea56c7ca3abfbe9c78819c9df9f789af39. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/562274a2 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/562274a2 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/562274a2 Branch: refs/heads/branch-3.1 Commit: 562274a20b35e24a58131c775592d6d8e3a04cc5 Parents: 401a0ee Author: Xiao ChenAuthored: Wed Feb 14 10:26:32 2018 -0800 Committer: Xiao Chen Committed: Wed Feb 14 10:26:54 2018 -0800 -- .../client/KerberosAuthenticator.java | 80 +++- .../client/TestKerberosAuthenticator.java | 29 --- 2 files changed, 27 insertions(+), 82 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/562274a2/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java -- diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java index 64d4330..942d13c 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java @@ -13,8 +13,6 @@ */ package org.apache.hadoop.security.authentication.client; -import com.google.common.annotations.VisibleForTesting; -import java.lang.reflect.Constructor; import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.security.authentication.server.HttpConstants; import org.apache.hadoop.security.authentication.util.AuthToken; @@ -179,62 +177,38 @@ public class KerberosAuthenticator implements Authenticator { */ @Override public void authenticate(URL url, AuthenticatedURL.Token token) - throws IOException, AuthenticationException { +throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0); - try { -HttpURLConnection conn = token.openConnection(url, connConfigurator); -conn.setRequestMethod(AUTH_HTTP_METHOD); -conn.connect(); - -boolean needFallback = false; -if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { - LOG.debug("JDK performed authentication on our behalf."); - // If the JDK already did the SPNEGO back-and-forth for - // us, just pull out the token. - AuthenticatedURL.extractToken(conn, token); - if (isTokenKerberos(token)) { -return; - } - needFallback = true; + HttpURLConnection conn = token.openConnection(url, connConfigurator); + conn.setRequestMethod(AUTH_HTTP_METHOD); + conn.connect(); + + boolean needFallback = false; + if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { +LOG.debug("JDK performed authentication on our behalf."); +// If the JDK already did the SPNEGO back-and-forth for +// us, just pull out the token. +AuthenticatedURL.extractToken(conn, token); +if (isTokenKerberos(token)) { + return; } -if (!needFallback && isNegotiate(conn)) { - LOG.debug("Performing our own SPNEGO sequence."); - doSpnegoSequence(token); -} else { - LOG.debug("Using fallback authenticator sequence."); - Authenticator auth = getFallBackAuthenticator(); - // Make sure that the fall back authenticator have the same - // ConnectionConfigurator, since the method might be overridden. - // Otherwise the fall back authenticator might not have the - // information to make the connection (e.g., SSL certificates) - auth.setConnectionConfigurator(connConfigurator); - auth.authenticate(url, token); -} - } catch (IOException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); - } catch (AuthenticationException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); +needFallback = true; + } + if (!needFallback && isNegotiate(conn)) { +LOG.debug("Performing our own SPNEGO sequence."); +
hadoop git commit: Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar."
Repository: hadoop Updated Branches: refs/heads/trunk f20dc0d57 -> 1f20f432d Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar." This reverts commit 332269de065d0f40eb54ee5e53b765217c24081e. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1f20f432 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1f20f432 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1f20f432 Branch: refs/heads/trunk Commit: 1f20f432d2472f92797ea01711ca4cc97e7b2b23 Parents: f20dc0d Author: Xiao ChenAuthored: Wed Feb 14 10:22:37 2018 -0800 Committer: Xiao Chen Committed: Wed Feb 14 10:25:05 2018 -0800 -- .../client/KerberosAuthenticator.java | 80 +++- .../client/TestKerberosAuthenticator.java | 29 --- 2 files changed, 27 insertions(+), 82 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1f20f432/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java -- diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java index 64d4330..942d13c 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java @@ -13,8 +13,6 @@ */ package org.apache.hadoop.security.authentication.client; -import com.google.common.annotations.VisibleForTesting; -import java.lang.reflect.Constructor; import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.security.authentication.server.HttpConstants; import org.apache.hadoop.security.authentication.util.AuthToken; @@ -179,62 +177,38 @@ public class KerberosAuthenticator implements Authenticator { */ @Override public void authenticate(URL url, AuthenticatedURL.Token token) - throws IOException, AuthenticationException { +throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0); - try { -HttpURLConnection conn = token.openConnection(url, connConfigurator); -conn.setRequestMethod(AUTH_HTTP_METHOD); -conn.connect(); - -boolean needFallback = false; -if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { - LOG.debug("JDK performed authentication on our behalf."); - // If the JDK already did the SPNEGO back-and-forth for - // us, just pull out the token. - AuthenticatedURL.extractToken(conn, token); - if (isTokenKerberos(token)) { -return; - } - needFallback = true; + HttpURLConnection conn = token.openConnection(url, connConfigurator); + conn.setRequestMethod(AUTH_HTTP_METHOD); + conn.connect(); + + boolean needFallback = false; + if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { +LOG.debug("JDK performed authentication on our behalf."); +// If the JDK already did the SPNEGO back-and-forth for +// us, just pull out the token. +AuthenticatedURL.extractToken(conn, token); +if (isTokenKerberos(token)) { + return; } -if (!needFallback && isNegotiate(conn)) { - LOG.debug("Performing our own SPNEGO sequence."); - doSpnegoSequence(token); -} else { - LOG.debug("Using fallback authenticator sequence."); - Authenticator auth = getFallBackAuthenticator(); - // Make sure that the fall back authenticator have the same - // ConnectionConfigurator, since the method might be overridden. - // Otherwise the fall back authenticator might not have the - // information to make the connection (e.g., SSL certificates) - auth.setConnectionConfigurator(connConfigurator); - auth.authenticate(url, token); -} - } catch (IOException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); - } catch (AuthenticationException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); +needFallback = true; + } + if (!needFallback && isNegotiate(conn)) { +LOG.debug("Performing our own SPNEGO sequence."); +doSpnegoSequence(token); +
hadoop git commit: Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar."
Repository: hadoop Updated Branches: refs/heads/branch-3.0 36c9dda07 -> 2f3415a4d Revert "HADOOP-12897. KerberosAuthenticator.authenticate to include URL on IO failures. Contributed by Ajay Kumar." This reverts commit 16b2cad8e8f5215325c51eb582f58640a386b06b. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2f3415a4 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2f3415a4 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2f3415a4 Branch: refs/heads/branch-3.0 Commit: 2f3415a4d6e3c70730f8ef733e99706b38756842 Parents: 36c9dda Author: Xiao ChenAuthored: Wed Feb 14 10:24:49 2018 -0800 Committer: Xiao Chen Committed: Wed Feb 14 10:25:15 2018 -0800 -- .../client/KerberosAuthenticator.java | 80 +++- .../client/TestKerberosAuthenticator.java | 29 --- 2 files changed, 27 insertions(+), 82 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2f3415a4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java -- diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java index 64d4330..942d13c 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java @@ -13,8 +13,6 @@ */ package org.apache.hadoop.security.authentication.client; -import com.google.common.annotations.VisibleForTesting; -import java.lang.reflect.Constructor; import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.security.authentication.server.HttpConstants; import org.apache.hadoop.security.authentication.util.AuthToken; @@ -179,62 +177,38 @@ public class KerberosAuthenticator implements Authenticator { */ @Override public void authenticate(URL url, AuthenticatedURL.Token token) - throws IOException, AuthenticationException { +throws IOException, AuthenticationException { if (!token.isSet()) { this.url = url; base64 = new Base64(0); - try { -HttpURLConnection conn = token.openConnection(url, connConfigurator); -conn.setRequestMethod(AUTH_HTTP_METHOD); -conn.connect(); - -boolean needFallback = false; -if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { - LOG.debug("JDK performed authentication on our behalf."); - // If the JDK already did the SPNEGO back-and-forth for - // us, just pull out the token. - AuthenticatedURL.extractToken(conn, token); - if (isTokenKerberos(token)) { -return; - } - needFallback = true; + HttpURLConnection conn = token.openConnection(url, connConfigurator); + conn.setRequestMethod(AUTH_HTTP_METHOD); + conn.connect(); + + boolean needFallback = false; + if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { +LOG.debug("JDK performed authentication on our behalf."); +// If the JDK already did the SPNEGO back-and-forth for +// us, just pull out the token. +AuthenticatedURL.extractToken(conn, token); +if (isTokenKerberos(token)) { + return; } -if (!needFallback && isNegotiate(conn)) { - LOG.debug("Performing our own SPNEGO sequence."); - doSpnegoSequence(token); -} else { - LOG.debug("Using fallback authenticator sequence."); - Authenticator auth = getFallBackAuthenticator(); - // Make sure that the fall back authenticator have the same - // ConnectionConfigurator, since the method might be overridden. - // Otherwise the fall back authenticator might not have the - // information to make the connection (e.g., SSL certificates) - auth.setConnectionConfigurator(connConfigurator); - auth.authenticate(url, token); -} - } catch (IOException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); - } catch (AuthenticationException ex){ -throw wrapExceptionWithMessage(ex, -"Error while authenticating with endpoint: " + url); +needFallback = true; + } + if (!needFallback && isNegotiate(conn)) { +LOG.debug("Performing our own SPNEGO sequence."); +