Skip to content

Commit

Permalink
Updated AzureIdentityAccessTokenProvider to be equivalent to the dotn…
Browse files Browse the repository at this point in the history
…et implementation with regard to internal handling of scopes

* Updated to version 1.1.1 in gradle.properties
* Updated to version 1.1.1 in UserAgentHandlerOption
* Fixed junit assert usage. API is expected, actual. Not actual, expected
  • Loading branch information
joakibj committed Mar 20, 2024
1 parent f7eaaae commit a961572
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,18 @@ public AzureIdentityAccessTokenProvider(
"com.microsoft.kiota.authentication.additional_claims_provided",
decodedClaim != null && !decodedClaim.isEmpty());

final TokenRequestContext context = new TokenRequestContext();
if (_scopes.isEmpty()) {
_scopes.add(uri.getScheme() + "://" + uri.getHost() + "/.default");
List<String> scopes;
if (!_scopes.isEmpty()) {
scopes = new ArrayList<>(_scopes);
} else {
scopes = new ArrayList<>();
scopes.add(uri.getScheme() + "://" + uri.getHost() + "/.default");
}
context.setScopes(_scopes);

final TokenRequestContext context = new TokenRequestContext();
context.setScopes(scopes);
span.setAttribute(
"com.microsoft.kiota.authentication.scopes", String.join("|", _scopes));
"com.microsoft.kiota.authentication.scopes", String.join("|", scopes));
if (decodedClaim != null && !decodedClaim.isEmpty()) {
context.setClaims(decodedClaim);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ private static void assertScopes(
new URI("https://graph.microsoft.com"), new HashMap<>());

List<String> actualScopes = tokenRequestContextArgumentCaptor.getValue().getScopes();
assertLinesMatch(actualScopes, Arrays.asList(expectedScopes));
assertLinesMatch(Arrays.asList(expectedScopes), actualScopes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public UserAgentHandlerOption() {}

private boolean enabled = true;
@Nonnull private String productName = "kiota-java";
@Nonnull private String productVersion = "1.0.6";
@Nonnull private String productVersion = "1.1.1";

/**
* Gets the product name to be used in the user agent header
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ org.gradle.caching=true
mavenGroupId = com.microsoft.kiota
mavenMajorVersion = 1
mavenMinorVersion = 1
mavenPatchVersion = 0
mavenPatchVersion = 1
mavenArtifactSuffix =

#These values are used to run functional tests
Expand Down

0 comments on commit a961572

Please sign in to comment.