Skip to content

Commit

Permalink
fixed azure iam auth wrong parameter bug
Browse files Browse the repository at this point in the history
  • Loading branch information
millerlin committed Jul 2, 2024
1 parent 6613a4b commit 5f9bd90
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
public class AzureAuthProvider implements CloudAuthProvider {
private static final String AZURE_AUTHORITY_HOST = "AZURE_AUTHORITY_HOST";
private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID";
private static final String AZURE_TENANT_ID = "AZURE_TENANT_ID";
private static final String AZURE_FEDERATED_TOKEN_FILE = "AZURE_FEDERATED_TOKEN_FILE";
//refers to com.azure.identity.extensions.implementation.token.AccessTokenResolverOptions
Expand Down Expand Up @@ -72,6 +73,7 @@ String exchangeToken() {

private HTTPRequest exchangeRequest() {
String azureAuthorityHost = System.getenv(AZURE_AUTHORITY_HOST);
String identityClientId = System.getenv(AZURE_CLIENT_ID);

Check warning on line 76 in core-ng/src/main/java/core/framework/internal/db/cloud/AzureAuthProvider.java

View check run for this annotation

Codecov / codecov/patch

core-ng/src/main/java/core/framework/internal/db/cloud/AzureAuthProvider.java#L76

Added line #L76 was not covered by tests
String identityTenantId = System.getenv(AZURE_TENANT_ID);
String azureAuthorityURL = Strings.format("{}{}/oauth2/v2.0/token", azureAuthorityHost, identityTenantId);

Expand All @@ -80,7 +82,7 @@ private HTTPRequest exchangeRequest() {
Map<String, String> form = new LinkedHashMap<>();
form.put("client_assertion", federatedToken);
form.put("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
form.put("client_id", user());
form.put("client_id", identityClientId);

Check warning on line 85 in core-ng/src/main/java/core/framework/internal/db/cloud/AzureAuthProvider.java

View check run for this annotation

Codecov / codecov/patch

core-ng/src/main/java/core/framework/internal/db/cloud/AzureAuthProvider.java#L85

Added line #L85 was not covered by tests
form.put("grant_type", "client_credentials");
form.put("scope", scope);

Expand Down

0 comments on commit 5f9bd90

Please sign in to comment.