Keycloak Configuration Guide for Canton Validator (Community)
Community-contributed end-to-end Keycloak configuration guide for Canton validators
This section features solutions shared by community members. While they haven’t been formally tested by the Splice maintainers, users are encouraged to verify the information independently. Contributions to enhance accuracy and completeness are always welcome.
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.
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
Your assigned PARTY_HINT identifier 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,000 seconds (60 days; adjust as desired)
Set Offline Session Idle Timeout to 2,592,000 seconds (30 days; adjust as desired)
Click Save to apply the changes.
Client Scopes Setup
Create the daml_ledger_api client 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
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
Audience mapper:
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 openid client 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
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
Subject mapper:
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 Connect and Client ID to ledger-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 Connect and Client ID to validator-app-backend.
Click Next.
In Capability config:
Set Client authentication to ON
Set Service accounts to ON
Set all other options to OFF
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 Connect and Client ID to wallet-web-ui.
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 returned access_token and verify it contains:
aud: ["https://canton.network.global"]
scope: "daml_ledger_api"
Configuration Notes
User Identifiers: Both LEDGER_API_ADMIN_USER and WALLET_ADMIN_USER must be UUIDs from Keycloak URLs, not usernames
Mapper Configuration: The daml_ledger_api scope 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_HINT value
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