Skip to content

Adding New StsWebIdentityTokenFileCredentialsProvider in sts module that accepts STSClien #3220

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 1 commit into from
Jun 10, 2022

Conversation

joviegas
Copy link
Contributor

@joviegas joviegas commented May 28, 2022

Extension of PR #2488

Adding New WebIdentityTokenFileCredentialsProvider in sts that accepts STSClient

Description

  • Currently the WebIdentityTokenFileCredentialsProvider is in core module and it creates AwsCredentialsProvider with Default Sts Client.
  • We cannot modify the WebIdentityTokenCredentialsProviderFactory because the interface is marked as @FunctionalInterface and also StsClient is not available in core package so would need to pass SdkClient which would be confusing.
  • Thus we have added a new WebIdentityTokenFileCredentialsProvider in Sts module and named it as StsWebIdentityTokenFileCredentialsProvider

Usage

  1. Credential provider that will read web identity token file path, aws role arn, aws session name from system properties or environment variables And DefaultStsClient
StsWebIdentityTokenFileCredentialsProvider.builder().build();
  1. Credential provider that will read web identity token file path, aws role arn, aws session name from system properties or environment variables And StsClient will be used as it is passed in the constructor.
StsWebIdentityTokenFileCredentialsProviderbuilder().stsClient(stsClient).build();

3 . Credential provider that will read web identity token file path, aws role arn, aws session name from Builders And StsClient will be used as it is passed in the Builder.

               StsWebIdentityTokenFileCredentialsProvider.builder()
                       .stsClient(stsClient)
                       .roleArn("someRole")
                       .webIdentityTokenFile(Paths.get(webIdentityTokenPath))
                       .roleSessionName("tempRoleSession")
                       .build();

Motivation and Context

Testing

  • Added JUnit Test cases.

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 read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • 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

@joviegas joviegas force-pushed the sts_token_provider_client branch from 568eea1 to b68a065 Compare June 3, 2022 17:01
@joviegas joviegas force-pushed the sts_token_provider_client branch 3 times, most recently from 3342c2e to e705792 Compare June 3, 2022 23:41
@joviegas joviegas force-pushed the sts_token_provider_client branch 5 times, most recently from 130de31 to 07ba2bd Compare June 8, 2022 20:15
@joviegas joviegas force-pushed the sts_token_provider_client branch from 2797dba to 5d29684 Compare June 10, 2022 14:50
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

78.0% 78.0% Coverage
0.0% 0.0% Duplication

@joviegas joviegas merged commit 54176e2 into aws:master Jun 10, 2022
aws-sdk-java-automation added a commit that referenced this pull request Sep 3, 2024
…1891860f8

Pull request: release <- staging/7715e9ec-107c-431f-800e-4b41891860f8
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