瀏覽代碼

YARN-9334. Allow YARN Service client to send SPNEGO challenge header when authentication type is not simple.
Contributed by Billie Rinaldi

(cherry picked from commit 04b228e43b728d574d7ad97330aa4218cb7f8bf8)

Eric Yang 6 年之前
父節點
當前提交
3f3548b66a

+ 1 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/client/ApiServiceClient.java

@@ -282,11 +282,10 @@ public class ApiServiceClient extends AppAdminClient {
   private Builder getApiClient(String requestPath)
       throws IOException {
     Client client = Client.create(getClientConfig());
-    Configuration conf = getConfig();
     client.setChunkedEncodingSize(null);
     Builder builder = client
         .resource(requestPath).type(MediaType.APPLICATION_JSON);
-    if (conf.get("hadoop.http.authentication.type").equals("kerberos")) {
+    if (UserGroupInformation.isSecurityEnabled()) {
       try {
         URI url = new URI(requestPath);
         String challenge = generateToken(url.getHost());