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:
| Setting | Decides | Default |
|---|---|---|
scopes | Which clients receive the value, and under which claim | Released nowhere |
userAccess | What the user may do with it on the account page and at sign-up | none |
applicationWrite | Whether a granted application may write it | No 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.; 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
type | A value | Constraints |
|---|---|---|
string, the default | Text of at most 1024 bytes | minLength, maxLength (characters, up to 1024), pattern (RE2, matched as a whole) |
boolean | true or false | |
integer | A whole number within ±(2^53−1) | minimum, maximum |
date | A calendar date, YYYY-MM-DD | earliest, latest |
enum | One of values | values: 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.
| Limit | Value |
|---|---|
| Declarations per organization | 64 |
| Keys on one user, declared or not | 64 |
| One user's attributes, encoded | 16 KiB |
| Members of a list | 32 |
| Scopes that release one attribute | 4 |
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_ 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.
| Where | When it carries the attribute |
|---|---|
| UserInfo | The client was granted one of its scopes. The value is typed as declared: a number, a boolean, a list. |
| ID token | It 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 token | The 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. |
| Introspection | Never. |
- Scopes. A release scope is printable ASCII without space,
"or\.openid,offline_access,profile,email,groups,address,phone,profile:writeand any scope beginningnauthera.are refused: a user who consents toprofileis told it releases their name and username, not a salary. A standard claim is released underprofilewhatever it declares. - The client asks for the scope. It must hold it in its
OIDCClient'sspec.scopesand 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,valueandvaluesconstrain nothing. - Discovery. The organization's
claims_supportedandscopes_supportedlist 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
accessTokenor raisesuserAccessis recorded at warning, withuser_attributes_widenedonorganization.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.
/accountbeneath the organization's issuer (https:for the main organization,/ / auth. example. com/ account https:for/ / auth. example. com/ orgs/ acme/ account acme) lists every attribute declaredreadorwrite, 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. Areadattribute shows as text, under what the organization manages. A visitor without a session signs in first and comes back. The page reads and writes throughGETandPATCH /.v1/ auth/ account/ profile - Sign-up. Self-service registration asks for every
requiredattribute declaredwrite, 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
noneorread, a standard claim the organization does not declare, or an undeclared name. - The display name. Registration's name field writes
name: taken wherenameis undeclared orwrite, refused under another access. The name an identity provider sends when its first sign-in creates an account is held to the rest ofname's declaration but not touserAccess, since a social provider's users choose their own.


Which applications may write
applicationWrite: true lets the organization's spec. 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.. 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"as42for 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
attributeson a user'sPOSTandPATCH; aPATCHreplaces the whole map. A refused value is a400validation_errorwhose field errors nameattributes.<name>(orattributes.<name>[i]for one member of a list) with the rule it breaks, such asnot_allowed,too_long,requiredorundeclared. See Admin API & Users. - Audit. Every change is
user.updated: an administrator's namesattributesinchanged; the user's (self_service) and a granted client's name eachattributes.<name>, with the client as the actor. Records carry names, never values.

Related
- Protect an API with a ProtectedResource: attributes in access tokens, and applications that update them
- Organization:
spec.userAttributesandspec.attributeWriteGrants - ProtectedResource:
spec.attributes - Tokens & Sender Constraint: the standard profile claims