To deploy a validator node with Keycloak authentication, follow these detailed configuration steps. This guide provides comprehensive instructions for setting up Keycloak as your validator’s OIDC provider, including all required customizations for your Canton network deployment. For additional authentication providers and configuration details, see Configuring Authentication.Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before proceeding with the configuration, ensure you have:- A running Keycloak instance with administrative access
- Admin Console access to your Keycloak deployment
- The following hostnames configured:
- Validator API base URL:
https://validator-api.your-domain.example/api - Wallet UI:
https://wallet.your-domain.example - CNS UI:
https://cns.your-domain.example
- Validator API base URL:
- Your assigned
PARTY_HINTidentifier from the Canton network
Realm Configuration
- Create the realm for your Canton validator.
- Navigate to Admin Console → Manage realms → Create realm.
- Set Realm name to
canton(or your environment-specific name). - Click Create to initialize the realm.
- Configure session settings for offline access and refresh tokens.
- Navigate to Realm Settings → Sessions.
- Configure the following settings:
- Set Offline Session Max Limited to
ON - Set Offline Session Max to
5,184,000seconds (60 days; adjust as desired) - Set Offline Session Idle Timeout to
2,592,000seconds (30 days; adjust as desired)
- Set Offline Session Max Limited to
- Click Save to apply the changes.
Client Scopes Setup
- Create the
daml_ledger_apiclient scope.- Navigate to Client Scopes → Create.
-
Configure the basic settings:
- Name:
daml_ledger_api - Protocol:
OpenID Connect - Type:
Default - Display on consent screen:
OFF - Include in token scope:
OFF
- Name:
- Click Save.
-
Add the required mappers to
daml_ledger_api: User Client Role mapper:- Navigate to daml_ledger_api → Mappers → Create
- Set Mapper Type to
User Client Role - Set Name to
daml_ledger_api_scope - Set Add to access token to
ON - Set Add to ID token, Add to userinfo, Add to token introspection, and Multivalued to
OFF - Click Save
- Navigate to daml_ledger_api → Mappers → Create
- Set Mapper Type to
Audience - Set Name to
audience - Set Included Custom Audience to
https://canton.network.global - Set Add to access token and Add to token introspection to
ON - Set Add to ID token and Add to lightweight access token to
OFF - Click Save
- Create the
openidclient scope.- Navigate to Client Scopes → Create.
-
Configure the settings:
- Name:
openid - Protocol:
OpenID Connect - Type:
Default - Display on consent screen:
OFF - Include in token scope:
ON
- Name:
- Click Save.
-
Add the required mappers to
openid: Validator API Audience mapper:- Navigate to openid → Mappers → Create
- Set Mapper Type to
Audience - Set Name to
aud - Set Included Custom Audience to
https://validator-api.your-domain.example/api - Set Add to access token and Add to token introspection to
ON - Set Add to ID token and Add to lightweight access token to
OFF - Click Save
- Navigate to openid → Mappers → Create
- Set Mapper Type to
Subject (sub) - Set Name to
sub - Set Add to access token and Add to token introspection to
ON - Set Add to lightweight access token to
OFF - Click Save
Client Configuration
- Create the ledger API resource client.
- Navigate to Clients → Create client.
- Set Client Type to
OpenID Connectand Client ID toledger-api. - Click Next.
- In Capability config, set all toggles to
OFF. - Click Next.
- Leave all Login settings fields empty and click Save.
- Add the client scope: Navigate to Client scopes → Add client scope → Select
daml_ledger_api→ Add as “Default”.
- Create the validator app backend service account client.
- Navigate to Clients → Create client.
- Set Client Type to
OpenID Connectand Client ID tovalidator-app-backend. - Click Next.
- In Capability config:
- Set Client authentication to
ON - Set Service accounts to
ON - Set all other options to
OFF
- Set Client authentication to
- Click Next.
- Leave Login settings fields empty and click Save.
- Record the credentials:
- From the Credentials tab, copy the Client Secret
- From the Service account roles tab, click the service account user link
- Copy the user ID (UUID) from the browser URL (use as
LEDGER_API_ADMIN_USER)
- Add the client scope: Navigate to Client scopes → Add client scope → Select
daml_ledger_api→ Add as “Default”.
- Create the wallet web UI public client.
- Navigate to Clients → Create client.
- Set Client Type to
OpenID Connectand Client ID towallet-web-ui. - Click Next.
- In Capability config:
- Set Standard flow to
ON - Set all other options to
OFF
- Set Standard flow to
- Click Next.
- Configure Login settings:
- Valid redirect URIs:
https://wallet.your-domain.example/* - Valid post logout redirect URIs:
https://wallet.your-domain.example - Web origins:
https://wallet.your-domain.example
- Valid redirect URIs:
- Click Save.
- Configure client scopes:
- Add
openidanddaml_ledger_apias “Default” - Add
offline_accessas “Optional” (if needed)
- Add
- Create the CNS UI public client.
- Follow the same process as the wallet web UI with these modifications:
- Set Client ID to
cns-ui - Set Valid redirect URIs to
https://cns.your-domain.example/* - Set Valid post logout redirect URIs to
https://cns.your-domain.example - Set Web origins to
https://cns.your-domain.example - Configure the same client scopes as wallet-web-ui
- Set Client ID to
- Follow the same process as the wallet web UI with these modifications:
User Management
- Create the operator wallet user.
- Navigate to Users → Add user.
- Configure the user:
- Set Username to your exact
PARTY_HINTvalue - Set User Enabled to
ON
- Set Username to your exact
- Click Save.
- Set a permanent password: Navigate to Credentials tab → Set password with Temporary set to
OFF. - Copy the user ID (UUID) from the browser URL (use as
WALLET_ADMIN_USER).
Application Configuration
Configure your validator application using the following Keycloak-related environment variables:Keycloak Realm Endpoints
AUTH_URL=https://your-keycloak-host/realms/canton AUTH_WELLKNOWN_URL=https://your-keycloak-host/realms/canton/.well-known/openid-configuration AUTH_JWKS_URL=https://your-keycloak-host/realms/canton/protocol/openid-connect/certsBackend Client Credentials
VALIDATOR_AUTH_CLIENT_ID=validator-app-backend VALIDATOR_AUTH_CLIENT_SECRET=REPLACE_WITH_CLIENT_SECRETUser Identity UUIDs (from Keycloak Users URLs)
LEDGER_API_ADMIN_USER=REPLACE_WITH_SERVICE_ACCOUNT_USER_UUID WALLET_ADMIN_USER=REPLACE_WITH_OPERATOR_USER_UUIDOAuth Scopes and Audiences
LEDGER_API_AUTH_SCOPE=daml_ledger_api LEDGER_API_AUTH_AUDIENCE=https://canton.network.global VALIDATOR_AUTH_AUDIENCE=https://validator-api.your-domain.example/apiUI Client IDs
WALLET_UI_CLIENT_ID=wallet-web-ui ANS_UI_CLIENT_ID=cns-uiValidation and Testing
-
Verify your configuration by testing the backend client credentials flow:
curl -X POST “https://your-keycloak-host/realms/canton/protocol/openid-connect/token”
-H “Content-Type: application/x-www-form-urlencoded”
-d “grant_type=client_credentials”
-d “client_id=validator-app-backend”
-d “client_secret=YOUR_CLIENT_SECRET” Decode the returnedaccess_tokenand verify it contains:aud:["https://canton.network.global"]scope:"daml_ledger_api"
Configuration Notes
- User Identifiers: Both
LEDGER_API_ADMIN_USERandWALLET_ADMIN_USERmust be UUIDs from Keycloak URLs, not usernames - Mapper Configuration: The
daml_ledger_apiscope uses both User Client Role and Audience mappers for comprehensive authorization - Token Audiences: UI tokens contain both standard OpenID Connect claims and your validator API audience
- Username Matching: The wallet admin user’s username must exactly match your
PARTY_HINTvalue
Troubleshooting
If you encounter authentication issues:- Verify that all audience mappings are correctly configured
- Ensure client scopes are properly assigned as “Default” types
- Confirm that user UUIDs are copied from Keycloak URLs rather than using usernames
- Check that session timeout values are appropriate for your use case