mirror of https://github.com/grpc/grpc-java.git
Allow both old and new behavior from google-auth-library-java
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: https://github.com/grpc/grpc-java/pull/8078#issuecomment-821566805 It's technically possible to exclude the newer Guava, but it's a good practice avoid excluding the newer version of a library.
This commit is contained in:
parent
a81bf14f1f
commit
84dc5642bc
|
@ -394,7 +394,11 @@ public class GoogleAuthLibraryCallCredentialsTest {
|
||||||
Map<?, ?> header = (Map<?, ?>) JsonParser.parse(jsonHeader);
|
Map<?, ?> header = (Map<?, ?>) JsonParser.parse(jsonHeader);
|
||||||
assertEquals("test-private-key-id", header.get("kid"));
|
assertEquals("test-private-key-id", header.get("kid"));
|
||||||
Map<?, ?> payload = (Map<?, ?>) JsonParser.parse(jsonPayload);
|
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("iss"));
|
||||||
assertEquals("test-email@example.com", payload.get("sub"));
|
assertEquals("test-email@example.com", payload.get("sub"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue