Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support ADC for Google Workspace (dwd/no-dwd) #240

Conversation

torfjor
Copy link
Contributor

@torfjor torfjor commented May 9, 2023

Overview

This commit adds support for authenticating to the Google Workspace Directory API through Application Default Credentials. ADC is assumed if ServiceAccount is left empty.

Authentication can be performed through domain-wide delegation of authority by impersonating a workspace user, or directly by granting the service account the necessary admin roles.

See the docs for authenticating as a service account without domain-wide delegation of authority.

This commit introduces a new config field,ImpersonatePrincipal. This field is used as a target service account to create a signed JWT for the Workspace user to impersonate. This is useful in a scenario where you are doing ADC with External Account Credentials but still need to impersonate a Workspace user through DWDoA. Since you don't have access to the service account's private key, you need an extra hop to the Service Account Credentials API to generate the signed JWT.

Related Issues/Pull Requests

Contributor Checklist

  • Add relevant docs to upstream Vault repository, or sufficient reasoning why docs won’t be added yet
    Docs commit
  • Add output for any tests not ran in CI to the PR description (eg, acceptance tests)
  • Backwards compatible

This commit adds support for authenticating to the Google
Workspace Directory API through [Application Default
Credentials](https://cloud.google.com/docs/authentication/application-default-credentials).
ADC is assumed if `ServiceAccount` is left empty.

Authentication can be performed through domain-wide delegation
of authority by impersonating a workspace user, or directly by
granting the service account the necessary admin roles.

See the
[docs](https://cloud.google.com/identity/docs/how-to/setup#auth-no-dwd)
for authenticating as a service account without domain-wide
delegation of authority.

This commit introduces a new config field,
`ImpersonatePrincipal`. This field is used as a target service
account to create a signed JWT for the Workspace user to
impersonate. This is useful in a scenario where you are doing
ADC with [External Account
Credentials](https://google.aip.dev/auth/4117) but still need
to impersonate a Workspace user through DWDoA. Since you don't
have access to the service account's private key, you need an
extra hop to the Service Account Credentials API to generate
the signed JWT.
@hashicorp-cla
Copy link

hashicorp-cla commented May 9, 2023

CLA assistant check
All committers have signed the CLA.

@austingebauer
Copy link
Contributor

Thanks, @torfjor! I'm having a look at this. Would you mind opening a PR for the documentation on the Vault repo? Thanks!

provider_gsuite.go Outdated Show resolved Hide resolved
provider_gsuite.go Outdated Show resolved Hide resolved
provider_gsuite.go Outdated Show resolved Hide resolved
provider_gsuite.go Outdated Show resolved Hide resolved
@torfjor
Copy link
Contributor Author

torfjor commented Jun 26, 2023

@austingebauer
Copy link
Contributor

Thanks, @torfjor

Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks, @torfjor!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants