Skip to content
Workforce IdentityMarkdown

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.

FieldDefaultDecides
namingAttruidThe 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). RealmViewer can 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.
  1. 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" }'
  2. 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" }'

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.

SymptomCauseFix
Some users can’t sign in after the changeThey have no value in the new attributeGive every user a value, or change back
Two users answer to one nameThe attribute’s values aren’t uniqueMake them unique before switching
Users must still type their old nameThe binding wasn’t savedRead it back with GET https://foobar.cvyuh.com/api/v0/am/objects/v1/identityBinding/identityBinding

PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/identityBinding/identityBinding with { "namingAttr": "uid" }.