-
Notifications
You must be signed in to change notification settings - Fork 8
Max/token exchange take 2 #59
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
Conversation
Updates tailscale/terraform-provider-tailscale#485 Signed-off-by: mcoulombe <[email protected]>
client.go
Outdated
| } | ||
|
|
||
| // Wrap the HTTP client's transport with the federated-idetity-aware transport | ||
| c.HTTP.Transport = transport |
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.
Mutating the HTTP client that's passed in isn't great, as it may be used elsewhere.
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.
It turns out we can just make a new http.Client that takes the important bits from the original client, like here.
ef1a6ba to
9031f13
Compare
Signed-off-by: mcoulombe <[email protected]>
9031f13 to
f965ee1
Compare
| // When set along with IDTokenFunc, the client will use identity federation for authentication. | ||
| // For OAuth, if empty and ClientSecret is provided, the ClientID will be derived from the ClientSecret. | ||
| // Overwrites APIKey if set. | ||
| ClientID string |
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.
Instead of adding more and more parameters to the Client type, let's just make different pluggable authentication mechanisms and plug them into a single place like here.
| return client | ||
| } | ||
|
|
||
| // oauthTokenSource implements oauth2.TokenSource using client credentials flow. |
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.
Ha, I don't know how I missed that you did this already!
|
Closing, we'll use a slightly different approach |
No description provided.