Skip to content

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

Merged
merged 3 commits into from
Apr 20, 2023

Conversation

gosar
Copy link
Contributor

@gosar gosar commented Apr 8, 2023

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@gosar gosar force-pushed the gosar/sra-ia-identity-token branch 4 times, most recently from 4a92a1f to 2e49e90 Compare April 11, 2023 19:25
@gosar gosar force-pushed the gosar/sra-ia-identity-token branch from 2e49e90 to eaf2108 Compare April 11, 2023 19:28
@gosar gosar marked this pull request as ready for review April 11, 2023 19:30
@gosar gosar requested a review from a team as a code owner April 11, 2023 19:30
@gosar gosar requested review from cenedhryn and joviegas and removed request for cenedhryn April 11, 2023 19:32
static TokenIdentity create(String token) {
Validate.paramNotNull(token, "token");

return new TokenIdentity() {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 57 Code Smells

54.3% 54.3% Coverage
2.1% 2.1% Duplication

@gosar gosar merged commit 53e2ffe into feature/master/sra-identity-auth Apr 20, 2023
@gosar gosar deleted the gosar/sra-ia-identity-token branch April 20, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants