in src/main/java/com/microsoft/azure/datalake/store/oauth2/AzureADAuthenticator.java [98:126]
public static AzureADToken getTokenFromMsi(String tenantGuid, String clientId, boolean bypassCache) throws IOException {
String authEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token";
QueryParams qp = new QueryParams();
qp.add("api-version", "2018-02-01");
qp.add("resource", resource);
if (tenantGuid != null && tenantGuid.length() > 0) {
String authority = "https://login.microsoftonline.com/" + tenantGuid;
qp.add("authority", authority);
}
if (clientId != null && clientId.length() > 0) {
qp.add("client_id", clientId);
}
if (bypassCache) {
qp.add("bypass_cache", "true");
}
Hashtable<String, String> headers = new Hashtable<String, String>();
headers.put("Metadata", "true");
RetryPolicy retryPolicy = new ExponentialBackoffPolicyforMSI(3, 1000, 2);
log.debug("AADToken: starting to fetch token using MSI");
return getTokenCall(authEndpoint, qp.serialize(), headers, "GET", retryPolicy);
}