HADOOP-15823. ABFS: Stop requiring client ID and tenant ID for MSI

(Contributed by Da Zhou via Daniel Templeton)

Change-Id: I546ab3a1df1efec635c08c388148e718dc4a9843
This commit is contained in:
Daniel Templeton 2018-10-24 14:18:35 -07:00
parent 69b328943e
commit e374584479
1 changed files with 2 additions and 5 deletions

View File

@ -110,9 +110,6 @@ public final class AzureADAuthenticator {
*/
public static AzureADToken getTokenFromMsi(String tenantGuid, String clientId,
boolean bypassCache) throws IOException {
Preconditions.checkNotNull(tenantGuid, "tenantGuid");
Preconditions.checkNotNull(clientId, "clientId");
String authEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token";
QueryParams qp = new QueryParams();
@ -120,12 +117,12 @@ public final class AzureADAuthenticator {
qp.add("resource", RESOURCE_NAME);
if (tenantGuid.length() > 0) {
if (tenantGuid != null && tenantGuid.length() > 0) {
String authority = "https://login.microsoftonline.com/" + tenantGuid;
qp.add("authority", authority);
}
if (clientId.length() > 0) {
if (clientId != null && clientId.length() > 0) {
qp.add("client_id", clientId);
}