Enable refreshing of auth_provider bearer_token#606
Enable refreshing of auth_provider bearer_token#606hmcguire-shopify wants to merge 1 commit intoManageIQ:masterfrom
Conversation
Previously, once a Kubeclient::Context was created, auth_provider bearer_tokens would be set and never refreshed. This commit enables automatic refreshing of auth_provider bearer_tokens by returning callables instead of static tokens. When used with the faraday client, the callable is automatically called for each request, and for the non-faraday client the callable is called before setting the header manually. Tests have been updated to cover this functionality for both client types, and an additional test was added for refreshing bearer_token_file because it did not appear to be covered before. Co-authored-by: Jonathan Gnagy <jonathan@therubyist.org> Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
|
Test failures appear to be because SSL certs need to be regenerated |
|
certs renewed, close-cycling to trigger CI. Sorry for my silence. It's great that you're attacking this! 👏 disclaimer: I know very little about all this auth! Performance / rate-limiting questions:Is it OK to call
I see you're going for automagically making refreshing work for people that use currently documented recipe: API questions:This PR only deals with
It's perfectly fine to defer API separation concern:I also feel our API has grown messy due to conflating config parsing + auth... Eventually, there should be separate APIs — probably separate objects for just reading the config and extracting one
I worry that if we make users rely on the existing recipe "Just Working", it may be more painful if eventually they need to switch to another API anyway? Plus the existing recipe passing multiple fields out of TLDR: this might be mergeable but I'd like us to understand future evolution path. But if you did this out of obligation to keep compatibility, I encourage you to not feel constrained — if users need to opt-in to a new API for renewal, that's totally worth it! |
|
cc @benlangfeld @jeremywadsack @timothysmith0609 @nov @dhstewart: I dumped some questions about this PR above, but you all know more about auth than I do, please help :)) With auth knowledge (and ability to test) being fragmented by provider, it's hard to make progress... Ooh one more point: current README recommends renewal by re-creating everything, even a new
[I've been saying "caching" but that's imprecise word for "keep this and don't come back without it"] |
Ref: #393
Previously, once a Kubeclient::Context was created, auth_provider bearer_tokens would be set and never refreshed.
This commit enables automatic refreshing of auth_provider bearer_tokens by returning callables instead of static tokens. When used with the faraday client, the callable is automatically called for each request, and for the non-faraday client the callable is called before setting the header manually.
Tests have been updated to cover this functionality for both client types, and an additional test was added for refreshing bearer_token_file because it did not appear to be covered before.