-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[extension/oauth2clientauth] Add EndpointParams #7307
Conversation
@jpkrohling I can take a review for this? Please assign this to me. |
@@ -76,6 +76,7 @@ func newClientCredentialsExtension(cfg *Config, logger *zap.Logger) (*ClientCred | |||
ClientSecret: cfg.ClientSecret, | |||
TokenURL: cfg.TokenURL, | |||
Scopes: cfg.Scopes, | |||
EndpointParams: cfg.EndpointParams, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tomsanbear. Can you please modify this test case as well https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/oauth2clientauthextension/extension_test.go#L48 in addition to the configuration test you modified. This test is a proper e2e use case.
Everything else LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pavankrish123 , thanks for the quick review, i've pushed the test up to the branch. Let me know if there is anything else you suggest to add 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have added a minor suggestion on the test. Please add the test and everything else LGTM
It's yours! |
Timeout: 2, | ||
ClientID: "testclientid", | ||
ClientSecret: "testsecret", | ||
EndpointParams: url.Values{"audience": []string{"someaudience"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add the equivalent assert to test the EndpointParams to complete the test -
opentelemetry-collector-contrib/extension/oauth2clientauthextension/extension_test.go
Line 135 in 549435e
assert.Equal(t, test.settings.Timeout, rc.client.Timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have update the test case with the assertion, thanks!
Thank you! @jpkrohling need help in kicking off the rest of the builds and on merge. |
@@ -58,6 +60,7 @@ Following are the configuration fields | |||
- [**token_url**](https://datatracker.ietf.org/doc/html/rfc6749#section-3.2) - The resource server's token endpoint URLs. | |||
- [**client_id**](https://datatracker.ietf.org/doc/html/rfc6749#section-2.2) - The client identifier issued to the client. | |||
- [**client_secret**](https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1) - The secret string associated with above identifier. | |||
- [**enndoint_params**](https://github.com/golang/oauth2/blob/master/clientcredentials/clientcredentials.go#L44) - Additional parameters that are sent to the token endpoint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [**enndoint_params**](https://github.com/golang/oauth2/blob/master/clientcredentials/clientcredentials.go#L44) - Additional parameters that are sent to the token endpoint. | |
- [**endpoint_params**](https://github.com/golang/oauth2/blob/master/clientcredentials/clientcredentials.go#L44) - Additional parameters that are sent to the token endpoint. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Anything we can do to get this merged in? CI fails don't seem related |
would be good to rebase, and ensure test pass. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Apologies from the spam as a result of the rebase, PR should be up to date with latest main now. |
Once you add a changelog entry, the CI should pass and I'll get this merged. Thanks for your patience! |
Sorry, just noticed that the linting is also failing:
|
@tomsanbear, sorry to ask this, but the PR seems to have been opened from your |
@jpkrohling updated! |
Fix open-telemetry#7307 --------- Signed-off-by: Alex Boten <aboten@lightstep.com>
Description:
Adds support to pass additional token endpoint parameters, in particular support for some oauth providers (in my case Ory Hydra) require the client to request the audience.
Link to tracking Issue: N/A
Testing: Tested on a custom build of the otel collector, in addition to adding unit test coverage.
Documentation: Added description of the endpoint param config in addition to an example in the readme.