Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc-auth's unit test stopped working after google-auth-library 0.25.0 #620

Closed
suztomo opened this issue Apr 1, 2021 · 1 comment
Closed

Comments

@suztomo
Copy link
Member

suztomo commented Apr 1, 2021

Also filed in grpc/grpc-java#8037 as I haven't figured whether this is grpc-auth's bug or google-auth-library's.

Failure

suztomo-macbookpro44% ./gradlew :grpc-auth:test
*** Skipping the build of codegen and compilation of proto files because skipCodegen=true
  * Skipping the build of Android projects because skipAndroid=true

> Task :grpc-auth:test

io.grpc.auth.GoogleAuthLibraryCallCredentialsTest > jwtAccessCredentialsInRequestMetadata FAILED
    org.junit.ComparisonFailure: expected:<https://example.com[:123/a.service]> but was:<https://example.com[/]>
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at io.grpc.auth.GoogleAuthLibraryCallCredentialsTest.jwtAccessCredentialsInRequestMetadata(GoogleAuthLibraryCallCredentialsTest.java:397)

16 tests completed, 1 failed

> Task :grpc-auth:test FAILED

How to reproduce

Checkout grpc-java repository and change google-auth-library dependency:

suztomo-macbookpro44% git diff                 
diff --git a/build.gradle b/build.gradle
index 9baf8e029..81fbc4d86 100644
--- a/build.gradle
+++ b/build.gradle
@@ -56,7 +56,7 @@ subprojects {
 
         nettyVersion = '4.1.52.Final'
         guavaVersion = '30.0-android'
-        googleauthVersion = '0.22.2'
+        googleauthVersion = '0.25.2'
         protobufVersion = '3.12.0'
         protocVersion = protobufVersion
         opencensusVersion = '0.28.0'

The test works fine in 0.24.1 (just before 0.25.0).

@arithmetic1728 It seems that some behavioral change was introduced in 0.25.0 version. The only change in 0.25.0s' release note was your PR. Do you think the behavior change on the library (ComparisonFailure: expected:<https://example.com[:123/a.service]> but was:<https://example.com[/]>) was expected or not?

@arithmetic1728
Copy link
Contributor

arithmetic1728 commented Apr 2, 2021

Yes it is the expected behavior. The reason is in RequestMetadata function of JWT credentials, we extract the http(s)://host_name/ part from the uri and use that as the audience instead of using the original uri. The port 123 and the path /a.service are ignored in this example. Please update the test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants