Skip to content

Commit

Permalink
Allow both old and new behavior from google-auth-library-java
Browse files Browse the repository at this point in the history
google-auth-library-java:0.25.0 strips port and path parts in the
audience claim ("aud"). Updating the test to pass in both old
and new version of google-auth-library-java.

This commit does not upgrade google-auth-library-java because
it turned out that the upgrade involves the newer Guava version
(google-auth-library-java's dependency) failing with DexingNoClasspathTransform.
Details: grpc#8078 (comment)
It's technically possible to exclude the newer Guava, but it's a
good practice avoid excluding the newer version of a library.
  • Loading branch information
ejona86 authored and suztomo committed Apr 16, 2021
1 parent 49f9380 commit a0f2f71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions android-interop-testing/build.gradle
Expand Up @@ -62,6 +62,7 @@ dependencies {
libraries.truth

implementation (libraries.google_auth_oauth2_http) {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'org.apache.httpcomponents'
}
censusGrpcMetricDependency 'implementation'
Expand Down
Expand Up @@ -394,7 +394,11 @@ public void jwtAccessCredentialsInRequestMetadata() throws Exception {
Map<?, ?> header = (Map<?, ?>) JsonParser.parse(jsonHeader);
assertEquals("test-private-key-id", header.get("kid"));
Map<?, ?> payload = (Map<?, ?>) JsonParser.parse(jsonPayload);
assertEquals("https://example.com:123/a.service", payload.get("aud"));
// google-auth-library-java 0.25.2 began stripping the grpc service name from the audience.
// Allow tests to pass with both the old and new versions for a while to avoid an atomic upgrade
// everywhere google-auth-library-java is used.
assertTrue("https://example.com/".equals(payload.get("aud"))
|| "https://example.com:123/a.service".equals(payload.get("aud")));
assertEquals("test-email@example.com", payload.get("iss"));
assertEquals("test-email@example.com", payload.get("sub"));
}
Expand Down

0 comments on commit a0f2f71

Please sign in to comment.