Skip to content
Directory & LifecycleMarkdown

Your own user type

Sign users in against a type you designed in place of the shipped user, and the realm gives it every field sign-in, tokens and groups need.

AvailableAPI

If your organization already has a model of a person, with its own name and attributes, you don’t have to fit it into the shipped user. Define your own type, point the realm at it, and sign-in, tokens, groups, secrets and agents all follow it.

  • Privilege: RealmOwner. The binding and the type it names are both realm configuration. See Who may do what.
  • Where: the API, with your session in $CVYUH_SESSION (see Call the API).
  • Do it before you add users, in a new realm: users already stored don’t move.

The realm signs users in against whatever type its identity binding names. By default that’s user, found by uid, with its password in passwordHash and its groups in memberOf. Point the binding at a type you designed, such as person, and every part of the realm reads users from it.

When you bind a type, the realm first gives it every attribute and link the shipped type carries, marked as carried, so nothing sign-in or tokens read is missing. An attribute you already gave it under one of those names is kept if its definition matches the shipped one, and the binding is refused if it doesn’t.

Binding fieldWhat it namesDefault
userTypeThe type users areuser
groupTypeThe type groups aregroup
agentTypeThe type AI agents areagent
namingAttrThe attribute users sign in withuid
passwordAttrThe attribute holding the passwordpasswordHash
membershipAttrThe link from a user to their groupsmemberOf
  1. Define your type, as Custom types describes, for example person.

  2. Point the binding at it:

    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 '{ "userType": "person" }'
  3. Read the type back with GET /types/v1/person: it now carries every shipped attribute beside yours.

AnswerCodeWhat it meansWhat to do
400POLICY_VIOLATIONAn attribute on your type has a carried name but a different definitionRename yours, or make its definition match the shipped one
400SCHEMA_VALIDATION_FAILEDThe binding body doesn’t read, such as an unknown fieldSend only the fields in the table above
412REVISION_CONFLICTYour type changed while the carried attributes were being addedSend the binding again

The change to the binding is recorded as PATCHED on identityBinding, and the carried attributes added to your type as UPDATED on the type, each with before and after.

SymptomCauseFix
Users can’t sign in after the binding changedThey’re stored as user, which is no longer the bound typePoint the binding back, or create them in the new type
A save of your type is refused 400, naming an attributeIt’s carried, and only its default and description can changeLeave it as it is
  • Bind before you add users. Users already stored as user don’t move to the new type, and once the binding points elsewhere they no longer sign in.
  • A carried attribute stays. On a bound type, the carried attributes can change only their default and description, as on the shipped user.