Skip to content
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

#18252 - [REQ] add sessionToken support to AWS4Auth #18253

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

mfriesen
Copy link
Contributor

Adds support for AWS Temporary credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html).

Involves adding to AWS4Auth.mustache
public void setCredentials(String accessKey, String secretKey, String sessionToken)

and

ApiClient.mustache
public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service)

PR checklist

  • [ X] Read the contribution guidelines.
  • [ X] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • [ X] Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh ./bin/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.1.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Mar 29, 2024

please follow step 3 to update the samples

@mfriesen
Copy link
Contributor Author

@wing328 I think everything should be updated now.

@wing328
Copy link
Member

wing328 commented Apr 1, 2024

Thanks @mfriesen

Can we wrap these changes inside the following mustache tags?

{{#withAWSV4Signature}}
...
{{/withAWSV4Signature}}

so that these code will only be included if the AWS auth option is enabled

e.g.

@mfriesen
Copy link
Contributor Author

mfriesen commented Apr 4, 2024

Sorry I'm not following.

I did wrap my new method
setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) with
{{#withAWSV4Signature}} {{/withAWSV4Signature}} just like the
public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) method.

@wing328 wing328 merged commit 97c1dc8 into OpenAPITools:master Apr 11, 2024
79 checks passed
@wing328
Copy link
Member

wing328 commented Apr 11, 2024

you're right, you did wrap it inside the function call.

i was expecting the whole method is wrapped inside the withAWSV4Signature mustache tag but the function above is not doing that either.

my intention is to completely skip the function when withAWSV4Signature is not enabled. (a user using the SDK maybe puzzle on why such AWS-related auth method exists given that the client has nothing to do with SDK)

we may address that in the upcoming v8.0.0 release as it's a potential breaking change.

thanks for the PR, which has been merged

@wing328 wing328 added this to the 7.5.0 milestone Apr 17, 2024
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