Expand description
Users, browser sessions and API tokens.
Structs§
- IdpLogout
- What a back-channel logout of the identity provider did.
- NewLocal
User - Oidc
Identity - Identity asserted by the OIDC provider after a successful login.
- User
Update
Enums§
- SignIn
- How a user signed in (recorded in the audit log).
- Token
Lifetime - How long a new token lives.
Constants§
- REAUTH_
WINDOW_ MINUTES - How long a fresh single sign-on counts as the sign-off of a review
decision (
TEAMCRAFT_APPROVAL_REAUTH).
Functions§
- active_
actor - The actor of an active user as it is now (memberships and hidden groups
read again);
Nonefor a deactivated or deleted user. Long-running work on behalf of a user (the assistant’s tool loop) calls this per step, so a lost membership or a newly restricted group applies at once. - actor
- Loads the full actor (incl. project memberships) for a user id.
- actor_
for_ api_ token - The user of a personal access token and the token’s scope;
Nonefor an unknown, expired or revoked token or a deactivated user. A use moves the expiry of a token with a sliding lifetime (idle_days) forward. - actor_
for_ session - authenticate_
local - Verifies username and password of a local account. Returns
Nonefor unknown users, wrong passwords, OIDC accounts and deactivated users. - change_
own_ password - Changes the caller’s own password after verifying the current one.
- confirm_
own_ password - Confirms the actor’s own password for a sign-off (#152 step 4).
- count
- create_
first_ admin - Creates the bootstrap administrator if the database contains no users. First start without any account: creates the administrator (the “create the administrator” form of the login page). Concurrent attempts are serialised with an advisory lock; once an account exists it fails.
- create_
local - Creates a local (password) account.
actor = Noneis used by the CLI and the bootstrap logic. - create_
session - Creates a session and returns the plaintext token for the cookie; the
sign-in is recorded in the audit log (
user.sign_in, never the token). - create_
token - Creates a personal access token. The plaintext is returned exactly once.
- delete_
session - Ends a web session (sign-out); recorded as
user.sign_out. An unknown or already ended session is not an error and leaves no entry. - ensure_
bootstrap_ admin - find_
by_ username - get
- idp_
logout - The identity provider logged the user with the subject
subout (OpenID Connect Back-Channel Logout, issue #173 step 9): their browser sessions end and the time is noted (users.idp_logout_at). An unknown subject does nothing (None). API and desktop tokens stay. - list
- list_
tokens - mark_
session_ reauthenticated - Marks the web session (by the hash of its token) of
user_idas signed in again just now. False when the session is not the user’s (or gone). - purge_
expired - Removes expired sessions and stale OIDC login attempts.
- record_
failed_ sign_ in - Records a failed password sign-in (
user.sign_in_failed). For an existing account the entry names it; for an unknown username it does not keep what was typed – that is often a password entered in the wrong field. The password itself is never recorded. - reviewer_
candidates - Active users that may be asked to review a change.
- revoke_
token - Deletes an API token (its owner, or an administrator).
- session_
actor - The user of a web session and when the session began (for the maximum
sign-in age of need-to-know groups);
Nonefor an unknown or expired session or a deactivated user. - session_
recently_ reauthenticated - Whether the web session
tokenof the user signed in again with single sign-on within the lastREAUTH_WINDOW_MINUTES. - set_
password - Sets the password of a local account.
actor = Noneis used by the CLI. - set_
preferred_ cad - Stores the preferred CAD program of the signed-in user: a format family
(
cadformat::families) or""= show all files alike. Display only – it never changes what the user may read or download. - set_
skin - Stores the UI skin of the signed-in user.
- token_
lifetime_ for - The lifetime of a new token of
user: for a single sign-on user capped byTEAMCRAFT_OIDC_TOKEN_IDLE_DAYS(sso_idle_days, 0 = off; issue #173), for anybody else as asked. - update
- Updates a user (admin only). The role of OIDC users is managed through IdP groups and is overwritten at their next login.
- upsert_
oidc_ user - Finds or provisions the user for an OIDC identity and synchronises name, e-mail and role (derived from groups) on every login.
- username_
from_ hint - Turns an IdP username (or e-mail address) into a valid TeamCraft username.