-
Notifications
You must be signed in to change notification settings - Fork 916
Accept and use the new TokenIdentity interfaces #3895
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
Accept and use the new TokenIdentity interfaces #3895
Conversation
4a92a1f
to
2e49e90
Compare
2e49e90
to
eaf2108
Compare
core/auth/src/main/java/software/amazon/awssdk/auth/token/credentials/TokenUtils.java
Outdated
Show resolved
Hide resolved
.../auth/src/main/java/software/amazon/awssdk/auth/token/credentials/SdkTokenProviderChain.java
Show resolved
Hide resolved
core/auth/src/main/java/software/amazon/awssdk/auth/token/credentials/TokenUtils.java
Outdated
Show resolved
Hide resolved
...h/src/test/java/software/amazon/awssdk/auth/token/credentials/SdkTokenProviderChainTest.java
Show resolved
Hide resolved
static TokenIdentity create(String token) { | ||
Validate.paramNotNull(token, "token"); | ||
|
||
return new TokenIdentity() { |
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.
Can you refresh my mind why we're doing the identity as an inline definition? Is it because we already have a token elsewhere?
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.
Yeah, the token implementations we have are in other modules
(sso/ssooidc). For AwsCredentials, there are implementations in the auth
module. Used anonymous inner classes here to avoid creating a named classes like AwsCredentialsIdentityImpl
or clashing names with AwsBasicCredentials
and followed the same approach here. I went off a comment from Matt during the surface area review, but I might have misinterpreted it. LMK if you think this should be organized differently.
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 rather not create more classes right now, this seems easier to change if needed so I think we should keep it.
SonarCloud Quality Gate failed. |
Motivation and Context
As part of SRA, earlier PR added the new interfaces. This PR updates existing code to accept and use the new Token specific interfaces.
Modifications
This PR updates existing interfaces where customers used to be able to provide SdkTokenProvider, to be able to provide the new interface - IdentityProvider<? extends TokenIdentity> - in service client builders (via codegen), SdkTokenProviderChain.
Testing
Added tests and
./mvnw clean install -pl :auth,:aws-core,:codegen,:codegen-generated-classes-test
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License