Skip to content

The v1 docs follow nauthera-server's main branch and its 0.x releases on the way to 1.0, so fields and APIs can still change.

v1

User Attributes

Docs version v1 (main)Nauthera is pre-1.0, in a design-partner programUpdated

An organization declares the attributes its users carry beside their account fields: a department, an employee number, a loyalty tier, a newsletter preference. Each one is typed, validated and labelled per language, and every writer is held to its declaration. Three settings of a declaration decide three separate things, and none of them implies another:

SettingDecidesDefault
scopesWhich clients receive the value, and under which claimReleased nowhere
userAccessWhat the user may do with it on the account page and at sign-upnone
applicationWriteWhether a granted application may write itNo application may

To carry attributes in the access tokens of an API, and to let a backend service update them, follow Protect an API with a ProtectedResource.

Declaring attributes

An Organization declares them in spec.userAttributes, in the order forms show them:

apiVersion: nauthera.io/v1alpha1
kind: Organization
metadata:
  name: acme
spec:
  slug: acme
  displayName: Acme
  namespaces: [acme]
  userAttributes:
    - name: department
      type: enum
      required: true
      userAccess: read
      scopes: [hr]
      accessToken: true
      labels: {en: Department, de: Abteilung}
      values:
        - {value: sales, labels: {en: Sales, de: Vertrieb}}
        - {value: engineering, labels: {en: Engineering, de: Entwicklung}}
    - name: employee_number
      type: integer
      minimum: 1
      scopes: [hr]
    - name: loyalty_tier
      type: enum
      userAccess: read
      applicationWrite: true
      values: [{value: bronze}, {value: silver}, {value: gold}]
    - name: newsletter
      type: boolean
      userAccess: write
      labels: {en: Send me the newsletter}

The main organization declares the same list, as YAML text, in orgs.main.user_attributes; a declaration it refuses stops startup, naming the field. nauthera-cli create org and update org take one with --user-attributes-file (see the CLI reference). The admin API and the dashboard only read it: user_attributes on the organization.

Types and constraints

typeA valueConstraints
string, the defaultText of at most 1024 bytesminLength, maxLength (characters, up to 1024), pattern (RE2, matched as a whole)
booleantrue or false
integerA whole number within ±(2^53−1)minimum, maximum
dateA calendar date, YYYY-MM-DDearliest, latest
enumOne of valuesvalues: up to 100 members, each with its own labels

multiValued: true makes a value a list of up to 32 distinct members of the type, bounded by minItems and maxItems. required: true refuses an administrator's create of a user without a value, and any write that removes it. labels and descriptions are keyed by BCP 47 tag of a language and an optional script, region and variants, such as de-CH: up to 16 of each, a label of at most 100 characters and a description of at most 500.

A name is a lower-case letter followed by up to 63 lower-case letters, digits and underscores. A claim the server sets itself or has not implemented, such as sub, email or groups, and any name beginning nauthera, are refused. A standard profile claim (name, given_name, family_name, middle_name, nickname, profile, picture, website, gender, birthdate, zoneinfo, locale) may be declared to constrain it: single-valued, a string or an enum, or a date for birthdate.

LimitValue
Declarations per organization64
Keys on one user, declared or not64
One user's attributes, encoded16 KiB
Members of a list32
Scopes that release one attribute4

The Organization resource's own rules catch a constraint on the wrong type, or a lower bound above its upper one, at kubectl apply. The server checks the rest (reserved names, patterns, language tags, scopes) and refuses the resource as Refused, naming user_attributes[i].<field> and the attribute.

Who receives an attribute

scopes names up to four scopes that release the attribute, under the claim claim names, or under its own name when claim is absent. A claim is a name as an attribute's is, or an https URI with a host and no #, of up to 256 characters.

WhereWhen it carries the attribute
UserInfoThe client was granted one of its scopes. The value is typed as declared: a number, a boolean, a list.
ID tokenIt was issued without an access token (response_type=id_token, which needs issuer.implicit_flow) and the grant holds one of its scopes. An ID token issued beside an access token carries none, and stays small.
Access tokenThe token is for a ProtectedResource that selects the attribute, the declaration sets accessToken: true, and the grant holds one of its scopes. See Attributes in access tokens.
IntrospectionNever.
  • Scopes. A release scope is printable ASCII without space, " or \. openid, offline_access, profile, email, groups, address, phone, profile:write and any scope beginning nauthera. are refused: a user who consents to profile is told it releases their name and username, not a salary. A standard claim is released under profile whatever it declares.
  • The client asks for the scope. It must hold it in its OIDCClient's spec.scopes and request it, and the user consents to it. A claims request (OpenID Connect Core 1.0 §5.5) that names a declared claim asks for the first of its scopes the client is registered for, unless the request holds one already; essential, value and values constrain nothing.
  • Discovery. The organization's claims_supported and scopes_supported list the claims its declaration releases and the scopes that release them, read on every request.
  • Only conforming values. A value that does not conform to its declaration is withheld, a declared standard claim's included. A broker releases none of a member organization's attributes.
  • From the next token. The declaration in force applies from the next token and the next UserInfo answer. A change that releases an attribute under a new scope or claim, sets accessToken or raises userAccess is recorded at warning, with user_attributes_widened on organization.updated.

What the user may do

userAccess is what the user may do with an attribute: none, the default, read it, or write it, which also lets them read it. It decides nothing about who receives the value; that is scopes.

  • The account page. /account beneath the organization's issuer (https://auth.example.com/account for the main organization, https://auth.example.com/orgs/acme/account for acme) lists every attribute declared read or write, with a control that fits its type: a switch for a boolean, a select for an enum, a date picker for a date, and one input per member of a list. A read attribute shows as text, under what the organization manages. A visitor without a session signs in first and comes back. The page reads and writes through GET and PATCH /v1/auth/account/profile.
  • Sign-up. Self-service registration asks for every required attribute declared write, refuses the account without one, and refuses any attribute the user may not write. A required attribute of another access is left for an administrator to fill.
  • Never more. A user never changes an attribute declared none or read, a standard claim the organization does not declare, or an undeclared name.
  • The display name. Registration's name field writes name: taken where name is undeclared or write, refused under another access. The name an identity provider sends when its first sign-in creates an account is held to the rest of name's declaration but not to userAccess, since a social provider's users choose their own.
The account page: each declared attribute with a control that fits its type, and Save
The account page: each declared attribute with a control that fits its type, and SaveOpen in Storybook
Sign-up asking for the organization's required attributes below the password
Sign-up asking for the organization's required attributes below the passwordOpen in Storybook

Which applications may write

applicationWrite: true lets the organization's spec.attributeWriteGrants name the attribute. It grants nothing by itself: a grant names one confidential OIDCClient, the attributes it may write and the users it may write them on, and the client then writes through the service attribute API with a client_credentials token, without any user-admin role. Only the Organization resource grants; no client can grant itself. The main organization's grants are orgs.main.attribute_write_grants. The whole flow is in Let an application update attributes.

Values stored before a declaration

An organization that declares nothing stores whatever an administrator writes, as strings. Once it declares one attribute:

  • every writer may add or change only a declared attribute or a standard profile claim, held to its declaration, and is refused any other with undeclared;
  • a value stored before stays until an administrator removes it, and a value resent as it is stored is never refused, so an unrelated edit never fails over old data;
  • a value reads through its declaration: text stored before a type was declared reads as its typed value when it converts ("42" as 42 for an integer), and a single value of a multi-valued attribute reads as a one-member list.

The admin API's read of one user lists what its values break under attribute_violations: an undeclared name, a value that does not conform, a required attribute with no value.

For administrators

  • The dashboard's user page edits declared attributes with typed inputs, and the create-user dialog asks for every required attribute, since the server refuses a new account without one. See Admin Dashboard.
  • The token claims page previews the tokens and the UserInfo answer a user would get from a client, and names each declared attribute it withholds and why: no release scope, a scope the client did not register or did not request, no value, or a value that breaks its declaration.
  • The admin API writes attributes on a user's POST and PATCH; a PATCH replaces the whole map. A refused value is a 400 validation_error whose field errors name attributes.<name> (or attributes.<name>[i] for one member of a list) with the rule it breaks, such as not_allowed, too_long, required or undeclared. See Admin API & Users.
  • Audit. Every change is user.updated: an administrator's names attributes in changed; the user's (self_service) and a granted client's name each attributes.<name>, with the client as the actor. Records carry names, never values.
A user's declared attributes, edited with an input that fits each type
A user's declared attributes on the dashboard, edited with inputs that fit each type.