-
Notifications
You must be signed in to change notification settings - Fork 229
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
feat: add workload identity federation support #547
Conversation
* feat: adds an internal token exchange utility based on https://tools.ietf.org/html/rfc8693 * fix: add copyright and address other comments * fix: fix formatting * fix: fixes copyright again * fix: revert pom changes * fix: revert auto-value changes * fix: remove gson and address other comments * fix: fixes to StsRequestHandlerTest
* feat: adds base external account credentials class and support for file/url based external credentials * fix: javadoc changes * fix: address review comments * fix: nits * fix: fix broken test * fix: format
* feat: implements AWS signature version 4 for signing requests * fix: fix javadoc * fix: address review comments * fix: changes to visibility and addresses other review comments * fix: removes sortedHeaderNames from AwsRequestSignature, uses MessageDigest, and misc changes * feat: generate authorization header in AwsRequestSigner * fix: address more review comments * fix: use RuntimeExceptions instead of invalid state/argument * fix: javadoc * fix: handle invalid input in Builder & misc fixes * fix: get dates at construction and no longer catch ParseException in AwsDates * fix: refactor AwsDates
* feat: adds text/json credential source support to IdentityPoolCredentials * fix: format * fix: format * fix: add missing changes to MockExternalAccountCredentialsTransport * fix: change parseToken to take an InputStream * fix: charsets * fix: broken build * fix: type null check
* feat: adds support for AWS credentials * fix: address nits * fix: remove Truth lib use in AwsCredentialsTest * fix: address more review comments * fix: assertEquals param order * feat: retrieve region from environment variable for AWS Lambda
…for 3pi (#501) * chore: use ImpersonatedCredentials for service account impersonation in ExternalAccountCredentials * chore: add test for invalid service account impersonation url
* fix: update AwsCredentials credential source logic * fix: remove TODOs * fix: cleanup * fix: code review nits * fix: fix broken test * fix: lint
Codecov Report
@@ Coverage Diff @@
## master #547 +/- ##
============================================
+ Coverage 79.92% 83.32% +3.39%
- Complexity 421 571 +150
============================================
Files 28 41 +13
Lines 1978 2645 +667
Branches 215 274 +59
============================================
+ Hits 1581 2204 +623
- Misses 284 301 +17
- Partials 113 140 +27
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot easier to review if you keep it on the same branch. Earlier comments apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge master
oauth2_http/java/com/google/auth/oauth2/AwsRequestSignature.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge in master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auth bits look good, please resolve comments from @elharo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge in master
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth considering if any of the public classes and methods should be marked @Beta
. In the near future it's going to be getting a lot harder to change something once we've shipped it than it has been in the past.
oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
Outdated
Show resolved
Hide resolved
* | ||
* <p>By default, attempts to exchange the external credential for a GCP access token. | ||
*/ | ||
public class AwsCredentials extends ExternalAccountCredentials { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this class need to be public? It looks like the only public methods are overridden or visible for testing, so I'm guessing no. The less API we have to publish and support ever after the better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep this public. Developers can initialize an AwsCredential and use it directly, and other credentials follow that pattern. They also need to be able to create an AwsCredential with specific scopes.
implements QuotaProjectIdProvider { | ||
|
||
/** Base credential source class. Dictates the retrieval method of the external credential. */ | ||
abstract static class CredentialSource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could/should this be an outer class? ExternalAccountCredentials is so large github won't even display it by default, which suggests it might help to break it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this makes sense as an outer class. It's required for all external credentials and not used in any other context. It's also confusing if you come across it outside of this class.
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java
Outdated
Show resolved
Hide resolved
oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java
Outdated
Show resolved
Hide resolved
throw new IllegalArgumentException("Invalid AWS environment ID."); | ||
} | ||
|
||
int environmentVersion = Integer.parseInt(matcher.group(2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more simply, this looks like the string simply equals the literal "aws1"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm we have to parse the version anyway for the error message
oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java
Outdated
Show resolved
Hide resolved
🤖 I have created a release \*beep\* \*boop\* --- ## [0.24.0](https://www.github.com/googleapis/google-auth-library-java/compare/v0.23.0...v0.24.0) (2021-02-19) ### Features * add workload identity federation support ([#547](https://www.github.com/googleapis/google-auth-library-java/issues/547)) ([b8dde1e](https://www.github.com/googleapis/google-auth-library-java/commit/b8dde1e43f86a0a00741790c12d73f6cbda6251d)) ### Bug Fixes * don't log downloads ([#576](https://www.github.com/googleapis/google-auth-library-java/issues/576)) ([6181030](https://www.github.com/googleapis/google-auth-library-java/commit/61810306dc0e18500a4a6b2704e00842fbecd879)) ### Documentation * add instructions for using workload identity federation ([#564](https://www.github.com/googleapis/google-auth-library-java/issues/564)) ([2142db3](https://www.github.com/googleapis/google-auth-library-java/commit/2142db314666f298071ae30a7419b00d48d87476)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
See go/guac-3pi-java.