Choose how ID tokens are signed
Pick the algorithm an app's ID tokens are signed with (RS256, ES256 or PS256), and which ones the realm offers.
APIOpenID Connect Core 1.0, RFC 7518
Each app gets its ID tokens signed with the algorithm it can check, signed with the realm’s key for that algorithm and published in the realm’s key set. Use this when an app’s library or policy needs a particular algorithm.
| Algorithm | When |
|---|---|
RS256 | The default. Every OpenID Connect library supports it |
ES256 | Smaller tokens and faster signing. The algorithm access tokens always use |
PS256 | Where RSA is required but RS256 isn’t allowed, as under FAPI 2.0 |
Access tokens are always ES256, whatever you choose here.
Before you start:
- Who can do it: a realm administrator, in a group that holds
RealmOwner(Delegated administration).RealmViewercan read the settings but not change them. - Where: today this is done through the API; Call the API shows how to get
$CVYUH_SESSION. - First: have the app’s client ID.
Set the algorithm
Section titled “Set the algorithm”-
For PS256 only, offer it in the realm. The realm offers RS256 and ES256 by default, and always RS256, as OpenID Connect requires:
Terminal window curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/keySettings/keySettings \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "algorithm": { "oauth2": { "idToken": ["RS256", "ES256", "PS256"] } } }' -
Set the app’s algorithm:
Terminal window curl -X PATCH 'https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client/<client-id>' \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "idTokenSignedResponseAlg": "ES256" }'
Check it worked
Section titled “Check it worked”Sign in to the app and decode the ID token’s header: its alg is the one you set, and its kid is in the realm’s key
set.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| The sign-in fails with no ID token | The client names an algorithm the realm doesn’t offer | Offer it in keySettings (step 1), or pick another |
| The app rejects the ID token’s signature | It checks against a cached key set, or expects another algorithm | Refresh its copy of the key set; match its expected alg |
Setting RS256 is refused | The client is held to FAPI 2.0 | Use ES256 or PS256 |
Undo it
Section titled “Undo it”PATCH the client with { "idTokenSignedResponseAlg": null }. Its ID tokens go back to the default: RS256, or ES256 under FAPI 2.0.
Good to know
Section titled “Good to know”- No fallback. A client that names an algorithm the realm doesn’t offer gets no ID token: the sign-in fails.
- FAPI 2.0 clients get ES256 by default, and may not use RS256. See Hold a client to FAPI 2.0.
Related
Section titled “Related”- OpenID Connect sign-in: ID tokens and their claims.
- Signing keys: the realm’s keys and key set.
- Choose which details an app receives: what the ID token carries.