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

This commit is contained in:
Jian He 2018-02-02 14:37:58 -08:00
parent 51cb6c5380
commit b6e50fad53
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}