HADOOP-15823. ABFS: Stop requiring client ID and tenant ID for MSI
(Contributed by Da Zhou via Daniel Templeton)
Change-Id: I546ab3a1df1efec635c08c388148e718dc4a9843
(cherry picked from commit e374584479
)
This commit is contained in:
parent
ede5cbd707
commit
3593b66693
|
@ -110,9 +110,6 @@ public final class AzureADAuthenticator {
|
||||||
*/
|
*/
|
||||||
public static AzureADToken getTokenFromMsi(String tenantGuid, String clientId,
|
public static AzureADToken getTokenFromMsi(String tenantGuid, String clientId,
|
||||||
boolean bypassCache) throws IOException {
|
boolean bypassCache) throws IOException {
|
||||||
Preconditions.checkNotNull(tenantGuid, "tenantGuid");
|
|
||||||
Preconditions.checkNotNull(clientId, "clientId");
|
|
||||||
|
|
||||||
String authEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token";
|
String authEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token";
|
||||||
|
|
||||||
QueryParams qp = new QueryParams();
|
QueryParams qp = new QueryParams();
|
||||||
|
@ -120,12 +117,12 @@ public final class AzureADAuthenticator {
|
||||||
qp.add("resource", RESOURCE_NAME);
|
qp.add("resource", RESOURCE_NAME);
|
||||||
|
|
||||||
|
|
||||||
if (tenantGuid.length() > 0) {
|
if (tenantGuid != null && tenantGuid.length() > 0) {
|
||||||
String authority = "https://login.microsoftonline.com/" + tenantGuid;
|
String authority = "https://login.microsoftonline.com/" + tenantGuid;
|
||||||
qp.add("authority", authority);
|
qp.add("authority", authority);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientId.length() > 0) {
|
if (clientId != null && clientId.length() > 0) {
|
||||||
qp.add("client_id", clientId);
|
qp.add("client_id", clientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue