Name users by your own directory's attributes
Tell the realm which attribute users sign in with, so sign-in, consent and tokens follow your directory.
API
If your users are described with attribute names of your own, for example signing in with an email address, tell the realm through its identity binding. Sign-in, consent, tokens and the admin pages all read the same binding, so they always agree.
| Field | Default | Decides |
|---|---|---|
namingAttr | uid | The attribute users sign in with, their name where they have no displayName, and their name in an agent’s business_owner claim |
The name a user is shown by is always their displayName attribute; the binding has no field for it. Leave the
binding’s other fields as they are.
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: every user must have the naming attribute you choose, and its values must be unique.
Set the binding
Section titled “Set the binding”-
Set the binding the first time. Fields you leave out keep their defaults:
Terminal window curl 'https://foobar.cvyuh.com/api/v0/am/objects/v1/identityBinding?id=identityBinding' \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "namingAttr": "email" }' -
To change it later:
Terminal window curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/identityBinding/identityBinding \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "namingAttr": "email" }'
Check it worked
Section titled “Check it worked”Sign in as a test user with their email address. The consent page, and the name detail apps receive, show the
user’s displayName, or the naming attribute where it is empty. Tokens are unaffected: sub is always the user’s
permanent ID, whatever they sign in with.
The change is in the realm’s change history as a record on identityBinding, before and after: see
Audit → Config in the dashboard.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| Some users can’t sign in after the change | They have no value in the new attribute | Give every user a value, or change back |
| Two users answer to one name | The attribute’s values aren’t unique | Make them unique before switching |
| Users must still type their old name | The binding wasn’t saved | Read it back with GET https://foobar.cvyuh.com/api/v0/am/objects/v1/identityBinding/identityBinding |
Undo it
Section titled “Undo it”PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/identityBinding/identityBinding with { "namingAttr": "uid" }.
Related
Section titled “Related”- OpenID Connect sign-in: how the user is named in tokens.
- Choose which details an app receives:
email,given_nameand the other details. - Consent: the page that shows the user’s name.