Skip to content

Commit 3167347

Browse files
build: use local google-auth-library in bazel tests (#12814)
Fixes #12774 --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
1 parent 7c0bfa4 commit 3167347

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
java_library(
2+
name = "credentials",
3+
srcs = glob(["java/**/*.java"]),
4+
visibility = ["//visibility:public"],
5+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
java_library(
2+
name = "oauth2_http",
3+
srcs = glob(["java/**/*.java"]),
4+
deps = [
5+
"@com_google_guava_guava//jar",
6+
"@com_google_guava_failureaccess//jar",
7+
"//google-auth-library-java/credentials:credentials",
8+
"@com_google_http_client_google_http_client//jar",
9+
"@com_google_http_client_google_http_client_gson//jar",
10+
"@com_google_api_api_common//jar",
11+
"@com_google_code_gson_gson//jar",
12+
"@com_google_errorprone_error_prone_annotations//jar",
13+
"@com_google_code_findbugs_jsr305//jar",
14+
"@com_google_auto_value_auto_value_annotations//jar",
15+
"@com_google_auto_value_auto_value//jar",
16+
"@org_slf4j_slf4j_api//jar",
17+
],
18+
plugins = ["@com_google_api_gax_java//:auto_value_plugin"],
19+
visibility = ["//visibility:public"],
20+
)

google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplier.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,8 @@ Map<String, Object> createMetadataRequestHeaders(AwsCredentialSource awsCredenti
235235
// Both flows work for IDMS v1 and v2. But if IDMSv2 is enabled, then if
236236
// session token is not present, Unauthorized exception will be thrown.
237237
if (awsCredentialSource.imdsv2SessionTokenUrl != null) {
238-
Map<String, Object> tokenRequestHeaders =
239-
new HashMap<String, Object>() {
240-
{
241-
put(AWS_IMDSV2_SESSION_TOKEN_TTL_HEADER, AWS_IMDSV2_SESSION_TOKEN_TTL);
242-
}
243-
};
238+
Map<String, Object> tokenRequestHeaders = new HashMap<>();
239+
tokenRequestHeaders.put(AWS_IMDSV2_SESSION_TOKEN_TTL_HEADER, AWS_IMDSV2_SESSION_TOKEN_TTL);
244240

245241
String imdsv2SessionToken =
246242
retrieveResource(

sdk-platform-java/gax-java/gax-grpc/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ _COMPILE_DEPS = [
1717
"@com_google_code_findbugs_jsr305//jar",
1818
"@com_google_code_gson_gson//jar",
1919
"@org_threeten_threetenbp//jar",
20-
"@com_google_auth_google_auth_library_oauth2_http//jar",
21-
"@com_google_auth_google_auth_library_credentials//jar",
20+
"@gapic_generator_java//google-auth-library-java/oauth2_http",
21+
"@gapic_generator_java//google-auth-library-java/credentials",
2222
"@com_google_api_grpc_proto_google_common_protos//jar",
2323
"@com_google_api_api_common//jar",
2424
"@com_google_auto_value_auto_value//jar",

sdk-platform-java/gax-java/gax-httpjson/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ _COMPILE_DEPS = [
1414
"@com_google_errorprone_error_prone_annotations//jar",
1515
"@org_threeten_threetenbp//jar",
1616
"@com_google_http_client_google_http_client//jar",
17-
"@com_google_auth_google_auth_library_oauth2_http//jar",
18-
"@com_google_auth_google_auth_library_credentials//jar",
17+
"@gapic_generator_java//google-auth-library-java/oauth2_http",
18+
"@gapic_generator_java//google-auth-library-java/credentials",
1919
"@com_google_api_api_common//jar",
2020
"@com_google_auto_value_auto_value//jar",
2121
"@com_google_auto_value_auto_value_annotations//jar",

sdk-platform-java/gax-java/gax/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ _COMPILE_DEPS = [
1111
"@com_google_api_api_common//jar",
1212
"@com_google_api_grpc_proto_google_common_protos//jar",
1313
"@com_google_protobuf_java//jar",
14-
"@com_google_auth_google_auth_library_credentials//jar",
15-
"@com_google_auth_google_auth_library_oauth2_http//jar",
14+
"@gapic_generator_java//google-auth-library-java/credentials",
15+
"@gapic_generator_java//google-auth-library-java/oauth2_http",
1616
"@com_google_auto_value_auto_value//jar",
1717
"@com_google_auto_value_auto_value_annotations//jar",
1818
"@com_google_code_findbugs_jsr305//jar",

0 commit comments

Comments
 (0)