Requires Enterprise plan. Contact sales for access.
Prerequisites
- Enable V3 tokens on the OIDC Token Configuration page in your organization settings. See Enable V3 tokens.
- Vault CLI installed in your environment and
VAULT_ADDRconfigured.
Step 1: Enable the JWT auth method
Enable the JWT auth method in Vault and configure it to trust Ona’s OIDC endpoint:https://app.gitpod.io/.well-known/jwks.json and validate tokens against them.
Step 2: Create a Vault role
Create a role that defines which Ona tokens are accepted and what Vault policies they receive.Organization-scoped role
Allow any environment in a specific Ona organization:Project-scoped role
Restrict to environments from a specific project:User-scoped role
Restrict to a specific user by email:Role parameters
| Parameter | Description |
|---|---|
bound_audiences | Must match the --audience used in ona idp token. Default: vault.hashicorp.com |
bound_claims | JSON object of claim-value pairs. All must match for authentication to succeed. Uses V3 flat claims. |
user_claim | The token claim to use as the Vault identity alias. Common choices: sub, email, user_id |
token_policies | Vault policies to attach to the issued token |
token_ttl | Initial TTL of the Vault token |
token_max_ttl | Maximum TTL the token can be renewed to |
Available V3 claims for bound_claims
You can bind on any V3 flat claim. Common choices:
organization_id- restrict to an Ona organizationproject_id- restrict to a specific projectenvironment_id- restrict to a specific environmentuser_id- restrict to a specific useremail- restrict by user emailcreator_email- restrict by who created the environmentrunner_id- restrict to environments on a specific runnerservice_account_id- restrict to a specific service account
Step 3: Create a Vault policy
Create a policy that grants the access your environments need:Step 4: Authenticate from an environment
Using the CLI shortcut
The Ona CLI has built-in Vault login support:vault write auth/jwt/login under the hood and calls vault login with the resulting token.
Options:
--role- the Vault role to authenticate against (defaults toIDP_VAULT_ROLEenv var)--audience- the token audience (default:vault.hashicorp.com)
Manual flow
If you need more control, use the Vault CLI directly:Automate on environment startup
Add the login to your automations:Using the Vault SDK
For programmatic access in your application:Using V2 tokens with Vault
V2 tokens also work with Vault’s JWT auth method. V2 tokens includeorg and gsub claims instead of the flat V3 claims. Use bound_claims on org for organization-scoped access:
email, project_id, or other flat claims, so fine-grained access control is limited to matching the sub claim. See the OIDC overview V2 section for the full V2 token reference.
Troubleshooting
“error validating token: invalid audience claim”- The
bound_audiencesin the Vault role must match the--audienceused inona idp token. - Default audience for Vault:
vault.hashicorp.com.
- The
bound_claimsvalues must exactly match the claims in your Ona token. - Decode your token:
ona idp token --audience vault.hashicorp.com --decode - Verify the claim values match what you configured in the Vault role.
- Vault cannot reach
https://app.gitpod.io/.well-known/openid-configuration. - Verify network connectivity from your Vault server to
app.gitpod.io.
- The Vault token was issued, but the attached policies do not grant access to the requested path.
- Check the
token_policieson the Vault role and the policy definitions.