auth0/go-jwt-middleware

Allow custom http Client to be used by the JWKS Provider

CBrather opened this issue · 2 comments

Checklist

Describe the problem you'd like to have solved

We are currently adding distributed tracing across our whole system and wanted to include spans for any calls to external systems as well. One of these is auth0, but using this middleware doesn't seem to allow us to add spans for the calls made by the jwks provider.

Describe the ideal solution

My idea would be to create an interface for http.Client and have the provider take that one. This way we could pass a custom client implementing the tracing logic via the WithCustomClient() option while maintaining backward compatibility with the existing implementation.

Alternatives and current workarounds

We don't build any workarounds as it's not a major issue for us, but rather a small improvement. If you don't want to have this in the official middleware, we'd possibly use a fork of our own where we make this change.

Additional context

No response

Hey @CBrather 👋🏻

Apologies if I'm not fully understanding, but is there a reason that jwks.WithCustomClient doesn't fit your requirements? If you're using OpenTelemetry (for example) it provides a Transport that can be added to a HTTPClient which should then be accepted by jwks.WithCustomClient

Hi @ewanharris,

no there is no reason for that, I must have been looking at the wrong (version?) documentation. Thank you for the link and the quick response, and sorry for wasting your time...