From 04b228e43b728d574d7ad97330aa4218cb7f8bf8 Mon Sep 17 00:00:00 2001 From: Eric Yang Date: Wed, 27 Feb 2019 18:47:14 -0500 Subject: [PATCH] YARN-9334. Allow YARN Service client to send SPNEGO challenge header when authentication type is not simple. Contributed by Billie Rinaldi --- .../apache/hadoop/yarn/service/client/ApiServiceClient.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/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 b/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 index a6d15026da..008f49792d 100644 --- a/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 +++ b/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 @@ -226,11 +226,10 @@ private Builder getApiClient() throws IOException { 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 = YarnClientUtils.generateToken(url.getHost());