Skip to content

Use Google Identity Server to Generate JWT for Ambient Credentials#39

Merged
doebrowsk merged 9 commits intorelease-2.1from
feat/AB#68671/jwt-token-from-oauth-credentials-2
Mar 21, 2025
Merged

Use Google Identity Server to Generate JWT for Ambient Credentials#39
doebrowsk merged 9 commits intorelease-2.1from
feat/AB#68671/jwt-token-from-oauth-credentials-2

Conversation

@irby
Copy link
Copy Markdown
Contributor

@irby irby commented Mar 12, 2025

This change set fixes an issue where the access token generated by using ambient credentials with GCP is not compatible with Command. The current code generates only an opaque access token, however Command requires the token be in JWT format.

Google's OAuth SDK does not expose a way to generate an OAuth access token in JWT format. Instead, the only way to produce a valid JWT signed by Google's OAuth server is by producing an ID token. The idtoken flow requires an audience. So, I've introduced a config value for audience that can be optionally set by the end user -- if not set, it will default the aud claim to command.

Because we are using an OIDC ID token instead of an OAuth access token, there are slight differences in the JWT produced. For example, the scopes provided will not appear in the JWT. However, end users can configure their Command instance to validate claims such as aud and email to assign identities to roles.

@irby irby changed the title Feat/ab#68671/jwt token from oauth credentials 2 Use Google Identity Server to Generate JWT for Ambient Credentials Mar 12, 2025
Comment thread internal/command/client.go Outdated
@doebrowsk doebrowsk merged commit a069de8 into release-2.1 Mar 21, 2025
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants