-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Supporting more credential formats #75
Conversation
- Supports service account impersonation - Supports GOOGLE_APPLICATION_CREDENTIALS pointing to application_default_credentials.json - Does not support external account credentials still
Also wondering if there are any documentation you would like to see for these items, and any automated tests. |
The existing do tests pass with this PR though. |
Co-authored-by: Fuyang Liu <[email protected]>
This seems to be centralizing/rewriting a lot of the logic into the Also in order to make large changes like these easy to review for the maintainers (at least, for me), these should be cleaned up and split up into smaller commits. For example, I would suggest improving |
Okay this morning I tested this in the real world
Had to make some changes, but everything is working now I also added tests to parse all the key formats I added here. I added some documentation of why I am doing things the way I do them. Since this is an internal module, I believe this documentation should be sufficient. I would appreciate if someone interested in this PR to give this a whirl in their environment, but other than that I think this PR is ready |
@djc Sorry I had typed up that comment before seeing your response. Firstly, there is a problem with just checking So here's what I propose to break this down into manageable chunks.
|
Yes, breaking down into those three chunks sounds good! |
See you in a future pr :) |
Solves #56.
This PR adds a new ServiceAccount implementation called
FlexibleTokenSource
.FlexibleTokenSource
combines the functionality currently supplied byConfigDefaultCredentials
andCustomServiceAccount
, and it improves the flexibility of each, currently supporting the service account, the user default credential account, and service account impersonation. All three of these approaches will work withGOOGLE_APPLICATION_CREDENTIALS
and~/.config/gcloud/application_default_credentials
.In
AuthenticationManager::new()
, I replaceConfigDefaultCredentials
andCustomServiceAccount
parsing attempts with the newFlexibleTokenSource
, because gives these improvements to both cases.Additionally, I removed the
ConfigDefaultCredentials
struct altogether. I was not able to removeCustomServiceAccount
because it is exposed in the public API for this crate. It also seems likeCustomServiceAccount
serves a specialized use case because it exposes methods likeCustomServiceAccount::signer()
, which is only possible when using the credential format with aprivate_key
field.I am leaving this as a draft for now because I want to get feedback on if this is the kind of PR you are looking for before I do the necessary testing in the real world.