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

feat: Add remoteoauth helpers (TokenAuthTransport and TokenAuthEditor) #1875

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

disq
Copy link
Member

@disq disq commented Aug 23, 2024

These helpers can be used to inject dynamic tokens into requests.

TokenAuthTransport is a http.RoundTripper, with optional custom rewriting capability
TokenAuthEditor(oauth2.TokenSource) returns a func(context.Context, *http.Request) error to be used as a RequestEditorFn in openapi clients.

@disq disq requested a review from a team as a code owner August 23, 2024 10:47
@disq disq requested a review from erezrokah August 23, 2024 10:47
@github-actions github-actions bot added the feat label Aug 23, 2024
Copy link

github-actions bot commented Aug 23, 2024

⏱️ Benchmark results

  • Glob-8 ns/op: 92.23


// TokenAuthEditor returns a custom RequestEditorFn to inject the OAuth2 token
func TokenAuthEditor(tokenSource oauth2.TokenSource) func(context.Context, *http.Request) error {
return func(_ context.Context, req *http.Request) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately we can't use the ctx here for the tokenSource.Token() call.

@disq disq added the automerge label Aug 27, 2024
@kodiakhq kodiakhq bot merged commit bb1be84 into main Aug 27, 2024
7 checks passed
@kodiakhq kodiakhq bot deleted the feat/add-remoteoauthhelpers branch August 27, 2024 18:56
kodiakhq bot pushed a commit that referenced this pull request Sep 3, 2024
🤖 I have created a release *beep* *boop*
---


## [4.61.0](v4.60.0...v4.61.0) (2024-09-02)


### Features

* Add remoteoauth helpers (`TokenAuthTransport` and `TokenAuthEditor`) ([#1875](#1875)) ([bb1be84](bb1be84))
* Add warning on duplicate clients for `round-robin` and `shuffle` schedulers ([#1878](#1878)) ([d148b94](d148b94))


### Bug Fixes

* **deps:** Update aws-sdk-go-v2 monorepo ([#1872](#1872)) ([80eb38a](80eb38a))
* **deps:** Update golang.org/x/exp digest to 9b4947d ([#1881](#1881)) ([bbeb846](bbeb846))
* **deps:** Update module github.com/aws/aws-sdk-go-v2/config to v1.27.30 ([#1876](#1876)) ([0319ff3](0319ff3))
* **deps:** Update module github.com/aws/aws-sdk-go-v2/config to v1.27.31 ([#1879](#1879)) ([4dc8f41](4dc8f41))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.12.8 ([#1870](#1870)) ([96a5194](96a5194))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.12.9 ([#1873](#1873)) ([76d4f9f](76d4f9f))
* **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.13.0 ([#1874](#1874)) ([e091d8a](e091d8a))
* **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.22.1 ([#1877](#1877)) ([11aaab4](11aaab4))
* **deps:** Update module golang.org/x/oauth2 to v0.22.0 ([#1883](#1883)) ([2a40306](2a40306))
* **deps:** Update module google.golang.org/grpc to v1.66.0 ([#1880](#1880)) ([a907ea6](a907ea6))
* **deps:** Update opentelemetry-go monorepo ([#1884](#1884)) ([9be63fe](9be63fe))
* Fix panic when converting schema changes to string ([#1885](#1885)) ([8274f17](8274f17))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants