Browse Source

YARN-7831. YARN Service CLI should use hadoop.http.authentication.type to determine authentication method. Contributed by Eric Yang

Jian He 7 years ago
parent
commit
b6e50fad53

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

@@ -123,7 +123,8 @@ public class ApiServiceClient extends AppAdminClient {
       api.append("/");
       api.append(appName);
     }
-    if (!UserGroupInformation.isSecurityEnabled()) {
+    Configuration conf = getConfig();
+    if (conf.get("hadoop.http.authentication.type").equalsIgnoreCase("simple")) {
       api.append("?user.name=" + UrlEncoded
           .encodeString(System.getProperty("user.name")));
     }
@@ -147,7 +148,7 @@ public class ApiServiceClient extends AppAdminClient {
     client.setChunkedEncodingSize(null);
     Builder builder = client
         .resource(getApiUrl(appName)).type(MediaType.APPLICATION_JSON);
-    if (conf.get("hadoop.security.authentication").equals("kerberos")) {
+    if (conf.get("hadoop.http.authentication.type").equals("kerberos")) {
       AuthenticatedURL.Token token = new AuthenticatedURL.Token();
       builder.header("WWW-Authenticate", token);
     }