From 0ca177d762a3814f15dc0f3d42a2d567638cb0f0 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Fri, 2 Apr 2021 23:43:17 +0800 Subject: [PATCH 1/3] patch to remove Jetty-server inclusion in hadoop-auth. Change-Id: I1d0e6dbe632cb8dafd2abb5c4a9e16fa8b487b72 (cherry picked from commit 7234b1d32fdcd093c77b8c8e0c99041b3d8d891a) --- hadoop-common-project/hadoop-auth/pom.xml | 4 ++-- .../authentication/server/AuthenticationFilter.java | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hadoop-common-project/hadoop-auth/pom.xml b/hadoop-common-project/hadoop-auth/pom.xml index 8e8526c7450e0..951498b6137f1 100644 --- a/hadoop-common-project/hadoop-auth/pom.xml +++ b/hadoop-common-project/hadoop-auth/pom.xml @@ -193,10 +193,10 @@ guava test - + diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java index 9f40c42d24135..584bb8aac543b 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java @@ -19,7 +19,6 @@ import org.apache.hadoop.security.authentication.client.AuthenticationException; import org.apache.hadoop.security.authentication.client.KerberosAuthenticator; import org.apache.hadoop.security.authentication.util.*; -import org.eclipse.jetty.server.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -621,7 +620,7 @@ && getMaxInactiveInterval() > 0) { errCode = HttpServletResponse.SC_FORBIDDEN; } // After Jetty 9.4.21, sendError() no longer allows a custom message. - // use setStatusWithReason() to set a custom message. + // use setStatus() to set a custom message. String reason; if (authenticationEx == null) { reason = "Authentication required"; @@ -629,10 +628,10 @@ && getMaxInactiveInterval() > 0) { reason = authenticationEx.getMessage(); } - if (httpResponse instanceof Response) { + /*if (httpResponse instanceof Response) { ((Response)httpResponse).setStatusWithReason(errCode, reason); - } - + }*/ + httpResponse.setStatus(errCode, reason); httpResponse.sendError(errCode, reason); } } From cf4a8f8d4fc0ca2558c99de044ff17c46d1e9e3b Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Tue, 6 Apr 2021 15:44:16 +0800 Subject: [PATCH 2/3] HADOOP-17625. Update to Jetty 9.4.39. Change-Id: Id835b146e1ce82aca53c49b3a67a4fc454e5b37a --- hadoop-project/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index bb021fcf2c0f8..5f81d75605a3d 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -37,7 +37,7 @@ true true - 9.4.35.v20201120 + 9.4.39.v20210325 _ _ From a631060f91e86be6f4a58e063e11c0fa099b4347 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Tue, 6 Apr 2021 15:51:41 +0800 Subject: [PATCH 3/3] Revert "patch to remove Jetty-server inclusion in hadoop-auth." This reverts commit 0ca177d762a3814f15dc0f3d42a2d567638cb0f0. --- hadoop-common-project/hadoop-auth/pom.xml | 4 ++-- .../authentication/server/AuthenticationFilter.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hadoop-common-project/hadoop-auth/pom.xml b/hadoop-common-project/hadoop-auth/pom.xml index 951498b6137f1..8e8526c7450e0 100644 --- a/hadoop-common-project/hadoop-auth/pom.xml +++ b/hadoop-common-project/hadoop-auth/pom.xml @@ -193,10 +193,10 @@ guava test - + diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java index 584bb8aac543b..9f40c42d24135 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java @@ -19,6 +19,7 @@ import org.apache.hadoop.security.authentication.client.AuthenticationException; import org.apache.hadoop.security.authentication.client.KerberosAuthenticator; import org.apache.hadoop.security.authentication.util.*; +import org.eclipse.jetty.server.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -620,7 +621,7 @@ && getMaxInactiveInterval() > 0) { errCode = HttpServletResponse.SC_FORBIDDEN; } // After Jetty 9.4.21, sendError() no longer allows a custom message. - // use setStatus() to set a custom message. + // use setStatusWithReason() to set a custom message. String reason; if (authenticationEx == null) { reason = "Authentication required"; @@ -628,10 +629,10 @@ && getMaxInactiveInterval() > 0) { reason = authenticationEx.getMessage(); } - /*if (httpResponse instanceof Response) { + if (httpResponse instanceof Response) { ((Response)httpResponse).setStatusWithReason(errCode, reason); - }*/ - httpResponse.setStatus(errCode, reason); + } + httpResponse.sendError(errCode, reason); } }