yup-oauth2
yup-oauth2 copied to clipboard
Implement service account impersonation.
This implements support for using user credentials to impersonate a service account.
I had a bit of trouble figuring out what to put as the "inner" authenticator, because in principle I think you can do service account impersonation starting from other kinds of authentication. This suggests possibly having
pub struct ServiceAccountImpersonationFlow {
inner: Authenticator<S>,
service_account_email: String,
}
but then it isn't clear what to put for S. I thought about using AuthFlow instead, but it's private to authenticator and I didn't want to start on reorganization without asking first. And since I've only ever tested the user credentials route, I decided to just start there.
To me this looks fine, although I haven't used the flow you're implementing. If you think this is ready to merge, let me know. Thank you for this contribution!
Maybe @blogle can be persuaded to take a quick peek. Otherwise, I think it's ready to merge.
looks good to me. As mentioned inline, you will want to update the initialization of TokenInfo before merging.