goth
goth copied to clipboard
Clarify documentation on impersonated token generation with service accounts
Thanks for your work on this, it is much appreciated. It took me quite a while to figure out how to do impersonation with a service account, so I've added a note to the documentation which will hopefully clarify things.
There are potential QoL changes that could be made to the code, but adding to the docs felt like the path of least resistance. If it's something you'd be interested in accepting a PR for, my pain points and suggested fixes would be:
- Confusion between top level option
scopesand claims keyscope. Suggested fixes:- (breaking change) rename top level option to
scope - Accept both
scopesandscopeand deprecatescopes - Validate all
optionsandclaimskeys and raise an error if an invalid key is passed.
- (breaking change) rename top level option to
- Confusion between top level
scopesaccepting a list of scopes, andclaims/scoperequiring a space separated string. Suggested fixes:- Gracefully handle passing of a list in
claims/scopeby performingEnum.join(scope, " ")for the user. - Raise an Error if
claims/scopeis not a string
- Gracefully handle passing of a list in
- Confusion around config element
actor_emailwhich is still in the code, but was removed from the README.md. Suggested fixes:- Document usage
- Deprecate usage
- I couldn't find the term
actorin Google's Documentation for this, the concept seems to variously be referred to asimpersonationorsubjectdepending on which documentation I read.actor_emailcould be renamed to be closer to the official docs.
- While trying to understand the interactions between top level options and
claimsI found it frustrating that I needed to switch from keyword list to map with string keys for claims each time. Suggested fixes:- Better docs should mostly negate this, so maybe no fix required.
- Could Stringify the
claimskeys rather than reject them if they're not strings. - Could also handle a keyword list and raise if there are duplicate keys.