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

[Go] Allow to use custom middleware #7403

Merged
merged 1 commit into from Mar 27, 2021
Merged

[Go] Allow to use custom middleware #7403

merged 1 commit into from Mar 27, 2021

Conversation

kuskoman
Copy link
Contributor

@kuskoman kuskoman commented Sep 11, 2020

This is a PR in response to my issue #7390. I need a way to create a custom authentication method (which is specific to a single cloud provider), however current code seems to make modifications to auth methods pretty hard (at least I did not find a way to provide custom header with dynamic value).
In this PR I allowed to do pretty much everything with http request, since I considered it an easy way to provide as many integrations as possible.

Since I am not sure if it's the expected way to fix these issues and I ran into some problems compiling this library I did not run all required scripts, but I am willing to once somebody approves the direction of proposed changes.

PR checklist

  • Read the contribution guidelines.
  • 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.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@antihax @grokify @kemokemo @bkabrda

@wing328
Copy link
Member

wing328 commented Sep 14, 2020

I need a way to create a custom authentication method (which is specific to a single cloud provider)

Which cloud provider is that?

There's an option to generate AWS v4 signature: withAWSV4Signature

@kuskoman
Copy link
Contributor Author

@wing328 HyperOne
Basically I need to generate JWT using data from file every time I am trying to make request

@ad-m
Copy link
Contributor

ad-m commented Sep 18, 2020

Tests for this PR are currently pass. What can we do to move forward this PR?

@fredericosilva
Copy link

@kuskoman could you squash it? it will simplify the review process :)

Prepare custom auth function template to be optional one

Rename auth function to middleware

Move middleware execution below operations with context

Generate samples for go

Modify new line characters in template not to affect default one

Generate samples with modified template
@ad-m
Copy link
Contributor

ad-m commented Sep 26, 2020

@houqp I have notice that your recently changed files affted by this PR. Could you provide any comments and review for that PR?

Copy link
Contributor

@houqp houqp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@FilipZajdel FilipZajdel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems OK to me.

Copy link

@Galatros Galatros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion it's ok.

@wing328
Copy link
Member

wing328 commented Mar 27, 2021

Thanks for all the review. The PR has been merged.

@wing328 wing328 added this to the 5.1.1 milestone Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants