From ad54320386b992f51436a9b28cbe7d3c6976714b Mon Sep 17 00:00:00 2001
From: "release-please[bot]"
<55107282+release-please[bot]@users.noreply.github.com>
Date: Wed, 10 Nov 2021 19:36:22 +0000
Subject: [PATCH 01/24] chore: release 1.3.1-SNAPSHOT (#793)
:robot: I have created a release \*beep\* \*boop\*
---
### Updating meta-information for bleeding-edge SNAPSHOT release.
---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
---
appengine/pom.xml | 2 +-
bom/pom.xml | 2 +-
credentials/pom.xml | 2 +-
oauth2_http/pom.xml | 2 +-
pom.xml | 2 +-
versions.txt | 12 ++++++------
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/appengine/pom.xml b/appengine/pom.xml
index a769c95fb..92fae75de 100644
--- a/appengine/pom.xml
+++ b/appengine/pom.xml
@@ -5,7 +5,7 @@
com.google.auth
google-auth-library-parent
- 1.3.0
+ 1.3.1-SNAPSHOT
../pom.xml
diff --git a/bom/pom.xml b/bom/pom.xml
index 879b89fe0..3310f2727 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.google.auth
google-auth-library-bom
- 1.3.0
+ 1.3.1-SNAPSHOT
pom
Google Auth Library for Java BOM
diff --git a/credentials/pom.xml b/credentials/pom.xml
index 86cab3d92..f43026054 100644
--- a/credentials/pom.xml
+++ b/credentials/pom.xml
@@ -4,7 +4,7 @@
com.google.auth
google-auth-library-parent
- 1.3.0
+ 1.3.1-SNAPSHOT
../pom.xml
diff --git a/oauth2_http/pom.xml b/oauth2_http/pom.xml
index 0c7a505a8..4c4b838cf 100644
--- a/oauth2_http/pom.xml
+++ b/oauth2_http/pom.xml
@@ -5,7 +5,7 @@
com.google.auth
google-auth-library-parent
- 1.3.0
+ 1.3.1-SNAPSHOT
../pom.xml
diff --git a/pom.xml b/pom.xml
index 1246251e8..3a3115548 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.google.auth
google-auth-library-parent
- 1.3.0
+ 1.3.1-SNAPSHOT
pom
Google Auth Library for Java
Client libraries providing authentication and
diff --git a/versions.txt b/versions.txt
index 9b3211db0..c7cd71f30 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,9 +1,9 @@
# Format:
# module:released-version:current-version
-google-auth-library:1.3.0:1.3.0
-google-auth-library-bom:1.3.0:1.3.0
-google-auth-library-parent:1.3.0:1.3.0
-google-auth-library-appengine:1.3.0:1.3.0
-google-auth-library-credentials:1.3.0:1.3.0
-google-auth-library-oauth2-http:1.3.0:1.3.0
+google-auth-library:1.3.0:1.3.1-SNAPSHOT
+google-auth-library-bom:1.3.0:1.3.1-SNAPSHOT
+google-auth-library-parent:1.3.0:1.3.1-SNAPSHOT
+google-auth-library-appengine:1.3.0:1.3.1-SNAPSHOT
+google-auth-library-credentials:1.3.0:1.3.1-SNAPSHOT
+google-auth-library-oauth2-http:1.3.0:1.3.1-SNAPSHOT
From 8cf273815f197a8b6b3d08043151005456824cbc Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Wed, 17 Nov 2021 22:56:31 +0100
Subject: [PATCH 02/24] chore(deps): update dependency
com.coveo:fmt-maven-plugin to v2.12 (#773)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[](https://renovatebot.com)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.googlejavaformat:google-java-format](https://togithub.com/google/google-java-format) | `1.7` -> `1.12.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
---
### Release Notes
google/google-java-format
### [`v1.12.0`](https://togithub.com/google/google-java-format/releases/v1.12.0)
[Compare Source](https://togithub.com/google/google-java-format/compare/v1.11.0...v1.12.0)
##### What's Changed
- Format type annotation as part of the type, not part of the modifiers list ([https://github.com/google/google-java-format/pull/653](https://togithub.com/google/google-java-format/pull/653))
- Fix indentation of case statements on JDK 17 ([https://github.com/google/google-java-format/pull/654](https://togithub.com/google/google-java-format/pull/654))
**Full Changelog**: https://github.com/google/google-java-format/compare/v1.11.0...v1.12.0
### [`v1.11.0`](https://togithub.com/google/google-java-format/releases/v1.11.0)
[Compare Source](https://togithub.com/google/google-java-format/compare/v1.10.0...v1.11.0)
`google-java-format` now has improved support for running on JDK 17 early access builds.
Changes:
- Handle `final` variables in `instanceof` patterns ([#588](https://togithub.com/google/google-java-format/issues/588))
- Fix handling of annotations in compact record constructors ([#574](https://togithub.com/google/google-java-format/issues/574))
- Fix a crash in `instanceof` pattern handling ([#594](https://togithub.com/google/google-java-format/issues/594))
- Wrap multiple values in switch expression case ([#540](https://togithub.com/google/google-java-format/issues/540))
- Fix formatting of module trees after [JDK-8255464](https://bugs.openjdk.java.net/browse/JDK-8255464)
- Support `sealed` classes ([#603](https://togithub.com/google/google-java-format/issues/603))
### [`v1.10.0`](https://togithub.com/google/google-java-format/releases/v1.10.0)
`google-java-format` now supports running on JDK 16. The following flags are required when running on JDK 16, due to [JEP 396: Strongly Encapsulate JDK Internals by Default](https://openjdk.java.net/jeps/396):
java \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-jar google-java-format-1.10.0-all-deps.jar T...
Other changes:
- Handle extra `;` in import lists (https://github.com/google/google-java-format/commit/b769e812a052d7cff4a2d86eff4981a5d358ee2d)
- Add missing space between unary `-` and negative literals (https://github.com/google/google-java-format/commit/6da736d786ac71a134ed6cc43e9cd825c83de0fd)
- Fix an off-by-one issue on the reflowing of string literals (https://github.com/google/google-java-format/commit/b9fd8d2242869ea7c9efd10cbbe7278c4b6611b1)
---
### Configuration
📅 **Schedule**: At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
â™» **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] If you want to rebase/retry this PR, click this checkbox.
---
This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/google-auth-library-java).
---
bom/pom.xml | 10 +---------
pom.xml | 10 +---------
2 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/bom/pom.xml b/bom/pom.xml
index 3310f2727..5bd427900 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -100,18 +100,10 @@
com.coveo
fmt-maven-plugin
- 2.9
+ 2.12
-
true
-
-
- com.google.googlejavaformat
- google-java-format
- 1.7
-
-
diff --git a/pom.xml b/pom.xml
index 3a3115548..9524bdb88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -207,18 +207,10 @@
com.coveo
fmt-maven-plugin
- 2.9
+ 2.12
-
true
-
-
- com.google.googlejavaformat
- google-java-format
- 1.7
-
-
org.codehaus.mojo
From 2c5de67e5607a058327d5cc0c8c37c626b45eb8e Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Mon, 22 Nov 2021 18:36:24 +0000
Subject: [PATCH 03/24] chore: remove enable-samples profile (#1284) (#796)
---
.github/.OwlBot.lock.yaml | 2 +-
.kokoro/build.sh | 1 -
CONTRIBUTING.md | 61 +++++----------------------------------
3 files changed, 8 insertions(+), 56 deletions(-)
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 886d09496..88d9b926c 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
- digest: sha256:14ecf64ec36f67c7bf04e3dc0f68eafcc01df3955121c38862b695e2ae7515d8
+ digest: sha256:5b8c790f57cca57e6b37ba25f79291265c218cea3e6ba9714b001910ab3f1419
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index 30e14cf64..6904cb7b3 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -91,7 +91,6 @@ samples)
pushd ${SAMPLES_DIR}
mvn -B \
- -Penable-samples \
-ntp \
-DtrimStackTrace=false \
-Dclirr.skip=true \
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f2dbdee06..b65dd279c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -53,12 +53,12 @@ mvn -Penable-integration-tests clean verify
## Code Samples
-Code Samples must be bundled in separate Maven modules, and guarded by a
-Maven profile with the name `enable-samples`.
+All code samples must be in compliance with the [java sample formatting guide][3].
+Code Samples must be bundled in separate Maven modules.
The samples must be separate from the primary project for a few reasons:
-1. Primary projects have a minimum Java version of Java 7 whereas samples have
- a minimum Java version of Java 8. Due to this we need the ability to
+1. Primary projects have a minimum Java version of Java 8 whereas samples can have
+ Java version of Java 11. Due to this we need the ability to
selectively exclude samples from a build run.
2. Many code samples depend on external GCP services and need
credentials to access the service.
@@ -68,39 +68,16 @@ The samples must be separate from the primary project for a few reasons:
### Building
```bash
-mvn -Penable-samples clean verify
+mvn clean verify
```
Some samples require access to GCP services and require a service account:
```bash
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json
-mvn -Penable-samples clean verify
+mvn clean verify
```
-### Profile Config
-
-1. To add samples in a profile to your Maven project, add the following to your
-`pom.xml`
-
- ```xml
-
- [...]
-
-
- enable-samples
-
- sample
-
-
-
- [...]
-
- ```
-
-2. [Activate](#profile-activation) the profile.
-3. Define your samples in a normal Maven project in the `samples/` directory.
-
### Code Formatting
Code in this repo is formatted with
@@ -110,30 +87,6 @@ To run formatting on your project, you can run:
mvn com.coveo:fmt-maven-plugin:format
```
-### Profile Activation
-
-To include code samples when building and testing the project, enable the
-`enable-samples` Maven profile.
-
-#### Command line
-
-To activate the Maven profile on the command line add `-Penable-samples` to your
-Maven command.
-
-#### Maven `settings.xml`
-
-To activate the Maven profile in your `~/.m2/settings.xml` add an entry of
-`enable-samples` following the instructions in [Active Profiles][2].
-
-This method has the benefit of applying to all projects you build (and is
-respected by IntelliJ IDEA) and is recommended if you are going to be
-contributing samples to several projects.
-
-#### IntelliJ IDEA
-
-To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in
-[Activate Maven profiles][3] to activate `enable-samples`.
-
[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account
[2]: https://maven.apache.org/settings.html#Active_Profiles
-[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles
+[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md
\ No newline at end of file
From aa6654a639ea15bcce7c7a6e86f170b1345895f0 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Mon, 6 Dec 2021 18:04:15 +0000
Subject: [PATCH 04/24] fix(java): add -ntp flag to native image testing
command (#1299) (#807)
---
.github/.OwlBot.lock.yaml | 2 +-
.kokoro/build.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 88d9b926c..3d2f82824 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
- digest: sha256:5b8c790f57cca57e6b37ba25f79291265c218cea3e6ba9714b001910ab3f1419
+ digest: sha256:a4d7b2cfc6a9d6b378a6b2458740eae15fcab28854bd23dad3a15102d2e47c87
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index 6904cb7b3..a9147b45e 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -71,7 +71,7 @@ integration)
;;
graalvm)
# Run Unit and Integration Tests with Native Image
- mvn test -Pnative -Penable-integration-tests
+ mvn -ntp -Pnative -Penable-integration-tests test
RETURN_CODE=$?
;;
samples)
From 94d374f38a4261cdbe454bc68237c5f629ec5324 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Mon, 6 Dec 2021 21:04:30 +0100
Subject: [PATCH 05/24] chore(deps): update dependency
com.google.appengine:appengine-api-1.0-sdk to v2 (#806)
Co-authored-by: Emily Ball
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 9524bdb88..b1df84024 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@
1.40.1
5.8.1
31.0.1-android
- 1.9.92
+ 2.0.0
3.0.2
false
1.8.2
From 20382279b69fae08b904692d267d6af3140275eb Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Mon, 6 Dec 2021 21:10:47 +0100
Subject: [PATCH 06/24] chore(deps): update dependency
com.google.appengine:appengine to v1.9.93 (#804)
Co-authored-by: Emily Ball
From c6dd664b00696708a1b715062214bf2607ae1652 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Mon, 6 Dec 2021 21:20:56 +0100
Subject: [PATCH 07/24] chore(deps): update dependency org.junit:junit-bom to
v5.8.2 (#801)
Co-authored-by: Emily Ball
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index b1df84024..3212a5e8b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,7 @@
UTF-8
1.40.1
- 5.8.1
+ 5.8.2
31.0.1-android
2.0.0
3.0.2
From af702ef9efb95dfc321d2480e564721bccfd222b Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Mon, 6 Dec 2021 21:31:45 +0100
Subject: [PATCH 08/24] chore(deps): update dependency
com.coveo:fmt-maven-plugin to v2.13 (#797)
Co-authored-by: Emily Ball
---
bom/pom.xml | 2 +-
pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bom/pom.xml b/bom/pom.xml
index 5bd427900..32f6bb42b 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -100,7 +100,7 @@
com.coveo
fmt-maven-plugin
- 2.12
+ 2.13
true
diff --git a/pom.xml b/pom.xml
index 3212a5e8b..5a7d06089 100644
--- a/pom.xml
+++ b/pom.xml
@@ -207,7 +207,7 @@
com.coveo
fmt-maven-plugin
- 2.12
+ 2.13
true
From 3686c35c8b922b08fc2aeb90c7a412e30ffbfcb6 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Mon, 6 Dec 2021 21:37:18 +0100
Subject: [PATCH 09/24] chore(deps): update dependency
com.google.appengine:appengine-api-1.0-sdk to v1.9.93 (#805)
Co-authored-by: Emily Ball
From c2e565f27d52a7c834661fa6935b87c6bf6e5a94 Mon Sep 17 00:00:00 2001
From: Emily Ball
Date: Tue, 7 Dec 2021 11:48:37 -0800
Subject: [PATCH 10/24] chore: update doclet version (#803)
Same as https://github.com/googleapis/java-shared-config/pull/368
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 5a7d06089..3c2d1b0eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -472,7 +472,7 @@
- java-docfx-doclet-1.3.0
+ java-docfx-doclet-1.4.0
${project.build.directory}/docfx-yml
${project.artifactId}
From c13ba4b24eb683e66a17654557176ae7f06e040e Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Thu, 9 Dec 2021 18:26:42 +0100
Subject: [PATCH 11/24] chore(deps): update dependency
com.google.appengine:appengine-api-1.0-sdk to v2.0.1 (#811)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 3c2d1b0eb..b40621c1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@
1.40.1
5.8.2
31.0.1-android
- 2.0.0
+ 2.0.1
3.0.2
false
1.8.2
From 5688837ca1fb3baab156af98126f0dbe8a668fd8 Mon Sep 17 00:00:00 2001
From: Chanseok Oh
Date: Mon, 13 Dec 2021 11:34:46 -0500
Subject: [PATCH 12/24] chore: update README to migrate deprecated usage (#810)
* Update README to migrate deprecated usage
* chore: update README to migrate deprecated usage
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index ca4e686e9..90f92a06d 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ If you are using Gradle, add this to your dependencies
[//]: # ({x-version-update-start:google-auth-library-oauth2-http:released})
```Groovy
-compile 'com.google.auth:google-auth-library-oauth2-http:1.3.0'
+implementation 'com.google.auth:google-auth-library-oauth2-http:1.3.0'
```
[//]: # ({x-version-update-end})
From 4df45d0d03a973f1beff43d8965c26289f217f22 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 4 Jan 2022 22:34:25 +0000
Subject: [PATCH 13/24] fix(java): run Maven in plain console-friendly mode
(#1301) (#818)
---
.github/.OwlBot.lock.yaml | 2 +-
.kokoro/build.sh | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 3d2f82824..731a0eb4a 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
- digest: sha256:a4d7b2cfc6a9d6b378a6b2458740eae15fcab28854bd23dad3a15102d2e47c87
+ digest: sha256:491a007c6bd6e77f9e9b1bebcd6cdf08a4a4ef2c228c123d9696845204cb685d
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index a9147b45e..317bf8686 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -47,15 +47,15 @@ set +e
case ${JOB_TYPE} in
test)
- mvn test -B -Dclirr.skip=true -Denforcer.skip=true
+ mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true
RETURN_CODE=$?
;;
lint)
- mvn com.coveo:fmt-maven-plugin:check
+ mvn com.coveo:fmt-maven-plugin:check -B -ntp
RETURN_CODE=$?
;;
javadoc)
- mvn javadoc:javadoc javadoc:test-javadoc
+ mvn javadoc:javadoc javadoc:test-javadoc -B -ntp
RETURN_CODE=$?
;;
integration)
@@ -71,7 +71,7 @@ integration)
;;
graalvm)
# Run Unit and Integration Tests with Native Image
- mvn -ntp -Pnative -Penable-integration-tests test
+ mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
RETURN_CODE=$?
;;
samples)
@@ -104,7 +104,7 @@ samples)
fi
;;
clirr)
- mvn -B -Denforcer.skip=true clirr:check
+ mvn -B -ntp -Denforcer.skip=true clirr:check
RETURN_CODE=$?
;;
*)
From 0e54aeef211cc9c3c2c29d8001d73aa871b3718e Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate
Date: Thu, 6 Jan 2022 16:25:48 +0100
Subject: [PATCH 14/24] chore(deps): update dependency
com.google.http-client:google-http-client-bom to v1.41.0 (#820)
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index b40621c1f..f4c2fb129 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,7 +59,7 @@
UTF-8
- 1.40.1
+ 1.41.0
5.8.2
31.0.1-android
2.0.1
From 6d35c681cf397ff2a90363184e26ee5850294c41 Mon Sep 17 00:00:00 2001
From: Leo <39062083+lsirac@users.noreply.github.com>
Date: Mon, 10 Jan 2022 11:35:26 -0800
Subject: [PATCH 15/24] fix: (WIF) remove erroneous check for the subject token
field name for text credential source (#822)
* fix: remove erroneous check for the subject token field name for text format in IdentityPoolCredentialSource
* fix: case insensitive
* fix: null check
* fix: imports
---
.../auth/oauth2/IdentityPoolCredentials.java | 22 +++--
.../oauth2/IdentityPoolCredentialsTest.java | 86 +++++++++++++++++++
2 files changed, 99 insertions(+), 9 deletions(-)
diff --git a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java b/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
index 44e9c0e93..200d56fbb 100644
--- a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
+++ b/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
@@ -52,6 +52,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;
@@ -132,18 +133,21 @@ enum CredentialFormatType {
Map formatMap = (Map) credentialSourceMap.get("format");
if (formatMap != null && formatMap.containsKey("type")) {
String type = formatMap.get("type");
- if (!"text".equals(type) && !"json".equals(type)) {
- throw new IllegalArgumentException(
- String.format("Invalid credential source format type: %s.", type));
- }
- credentialFormatType =
- type.equals("text") ? CredentialFormatType.TEXT : CredentialFormatType.JSON;
- if (!formatMap.containsKey("subject_token_field_name")) {
+ if (type != null && "json".equals(type.toLowerCase(Locale.US))) {
+ // For JSON, the subject_token field name must be provided.
+ if (!formatMap.containsKey("subject_token_field_name")) {
+ throw new IllegalArgumentException(
+ "When specifying a JSON credential type, the subject_token_field_name must be set.");
+ }
+ credentialFormatType = CredentialFormatType.JSON;
+ subjectTokenFieldName = formatMap.get("subject_token_field_name");
+ } else if (type != null && "text".equals(type.toLowerCase(Locale.US))) {
+ credentialFormatType = CredentialFormatType.TEXT;
+ } else {
throw new IllegalArgumentException(
- "When specifying a JSON credential type, the subject_token_field_name must be set.");
+ String.format("Invalid credential source format type: %s.", type));
}
- subjectTokenFieldName = formatMap.get("subject_token_field_name");
}
}
diff --git a/oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java b/oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java
index 33f55dfc6..5f8dc3ca0 100644
--- a/oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java
+++ b/oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java
@@ -415,6 +415,92 @@ void refreshAccessToken_workforceWithServiceAccountImpersonation() throws IOExce
assertEquals(expectedInternalOptions.toString(), query.get("options"));
}
+ @Test
+ void identityPoolCredentialSource_validFormats() {
+ Map credentialSourceMapWithFileTextSource = new HashMap<>();
+ Map credentialSourceMapWithFileJsonTextSource = new HashMap<>();
+ Map credentialSourceMapWithUrlTextSource = new HashMap<>();
+ Map credentialSourceMapWithUrlJsonTextSource = new HashMap<>();
+
+ credentialSourceMapWithFileTextSource.put("file", "/path/to/file");
+ credentialSourceMapWithFileJsonTextSource.put("file", "/path/to/file");
+
+ credentialSourceMapWithUrlTextSource.put("url", "https://google.com");
+ credentialSourceMapWithUrlJsonTextSource.put("url", "https://google.com");
+ Map headersMap = new HashMap<>();
+ headersMap.put("header1", "value1");
+ headersMap.put("header2", "value2");
+ credentialSourceMapWithUrlTextSource.put("headers", headersMap);
+ credentialSourceMapWithUrlJsonTextSource.put("headers", headersMap);
+
+ Map textFormat = new HashMap<>();
+ textFormat.put("type", "text");
+
+ Map jsonTextFormat = new HashMap<>();
+ jsonTextFormat.put("type", "json");
+ jsonTextFormat.put("subject_token_field_name", "access_token");
+
+ credentialSourceMapWithFileTextSource.put("format", textFormat);
+ credentialSourceMapWithFileJsonTextSource.put("format", jsonTextFormat);
+
+ credentialSourceMapWithUrlTextSource.put("format", textFormat);
+ credentialSourceMapWithUrlJsonTextSource.put("format", jsonTextFormat);
+
+ List