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

Upgrading Google auth library to 0.25.2 with dependency exclusion #8078

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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("[email protected]", payload.get("iss"));
assertEquals("[email protected]", payload.get("sub"));
}
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ subprojects {

nettyVersion = '4.1.52.Final'
guavaVersion = '30.0-android'
googleauthVersion = '0.22.2'
googleauthVersion = '0.25.2'
googlehttpVersion = '1.39.1'
protobufVersion = '3.12.0'
protocVersion = protobufVersion
opencensusVersion = '0.28.0'
Expand Down Expand Up @@ -150,11 +151,13 @@ subprojects {
cronet_embedded: 'org.chromium.net:cronet-embedded:66.3359.158',
gson: "com.google.code.gson:gson:2.8.6",
guava: "com.google.guava:guava:${guavaVersion}",
httpcore: "org.apache.httpcomponents:httpcore:4.4.14",
javax_annotation: 'org.apache.tomcat:annotations-api:6.0.53',
jsr305: 'com.google.code.findbugs:jsr305:3.0.2',
google_api_protos: 'com.google.api.grpc:proto-google-common-protos:2.0.1',
google_auth_credentials: "com.google.auth:google-auth-library-credentials:${googleauthVersion}",
google_auth_oauth2_http: "com.google.auth:google-auth-library-oauth2-http:${googleauthVersion}",
google_http_client_jackson2: "com.google.http-client:google-http-client-jackson2:${googlehttpVersion}",
Copy link
Contributor Author

@suztomo suztomo Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because grpc-xds uses a class from the artifact:

> Task :grpc-xds:compileJava FAILED
/Users/suztomo/grpc-java/xds/src/main/java/io/grpc/xds/internal/sts/StsCredentials.java:29: error: package com.google.api.client.json.jackson2 does not exist
import com.google.api.client.json.jackson2.JacksonFactory;

It was a used-but-undeclared dependency.

okhttp: 'com.squareup.okhttp:okhttp:2.7.4',
okio: 'com.squareup.okio:okio:1.17.5',
opencensus_api: "io.opencensus:opencensus-api:${opencensusVersion}",
Expand Down Expand Up @@ -250,10 +253,12 @@ subprojects {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'io.grpc', module: 'grpc-context'
exclude group: 'io.opencensus', module: 'opencensus-api'
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
}
dependencies.runtimeOnly project(':grpc-context')
censusApiDependency 'runtimeOnly'
guavaDependency 'runtimeOnly'
dependencies.runtimeOnly libraries.httpcore
}

// A util function to config perfmark dependency with transitive
Expand Down
10 changes: 10 additions & 0 deletions xds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
libraries.re2j,
libraries.bouncycastle,
libraries.autovalue_annotation

def nettyDependency = implementation project(':grpc-netty')

implementation (libraries.opencensus_proto) {
Expand All @@ -51,6 +52,15 @@ dependencies {
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
}

implementation (libraries.google_http_client_jackson2) {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'io.grpc', module: 'grpc-context'
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
exclude group: 'junit', module: 'junit'
}
runtimeOnly libraries.httpcore

testImplementation project(':grpc-core').sourceSets.test.output

annotationProcessor libraries.autovalue
Expand Down