Commit Graph
126 Commits
Author SHA1 Message Date
Devon Hudson 04530732ef Merge branch 'devonh/token-allowed-emails' into quenting/guest-invite-link-design 2026-11-13 21:19:48 +00:00
Devon Hudson c6214ae6bd Merge branch 'devonh/invite-guests' into devonh/token-allowed-emails
# Conflicts:
#	crates/handlers/src/views/register/password.rs
2026-11-13 21:19:48 +00:00
Devon Hudson e93bfedf84 Merge branch 'devonh/open-room' into devonh/invite-guests 2026-11-13 21:16:46 +00:00
Devon Hudson 113496e2e0 Merge branch 'devonh/username-templates' into devonh/open-room
# Conflicts:
#	crates/handlers/src/views/register/mod.rs
2026-11-13 21:16:46 +00:00
Devon Hudson fa80e3a4cb Merge branch 'devonh/register-invite-links' into devonh/username-templates 2026-11-13 21:14:05 +00:00
Devon HudsonandClaude Opus 5.5 c6d1eb10d3 Warn that a custom registration token must be hard to guess
Its invite URL shows whoever holds it the username and email address the token imposes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJcPorK3QoHp6G6hsYt
2026-11-13 21:10:23 +00:00
Devon HudsonandClaude Opus 5.5 5e30e40f75 Name the registration without an email by what it does
A token that is passwordless, has a username template and has no email
address pinned or allowed registers with only a display name. That
condition was called an invite link, though every token has an invite
link (`invite_url`), and a link listing the addresses allowed to use it
didn't count as one. It is now `registers_without_email()`, and
`without_email` on the registration page.

The page's other names drop the guest and link wording for what MAS
checks: `passwordless` for any valid passwordless token, with the
heading strings and the login link's prop named the same way. What the
page says is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJcZUXYbZ74Y9v5jZ7y
2026-11-10 20:16:36 +00:00
Devon HudsonandClaude Opus 5.5 abae562e3c Hold registrations to a token's allowed email addresses
With a token listing the addresses it allows, `POST /register` refuses
any other with an error on the email field, before a code is sent, and
the island explains it without naming the listed addresses.

One check on the token covers a pinned address and a list, in
`POST /register`, the token step and the last checks when finishing.
The last two read the token as it stands then, so a list replaced while
a registration is under way applies to it. `invite-emails` sends a
listed token only to an address on its list.

A passwordless token with a list skips the registration rate limit, as
one with a pinned email does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJYpWHZUTqexCFxqUAq
2026-11-10 01:01:46 +00:00
fc8b57db45 HACK: guest invite links without an email, display name on the first step
Design alignment for the Guest-XP Figma, not for merge.

An invite link (passwordless token, username template, no pinned email)
registers a guest with a display name and no email: the first step asks
for the display name, finish skips the email code and the display-name
step. It names no address, so it stays under the per-IP registration
rate limit. Email invites only get the new heading, subtitle and icon.

A token listing the addresses allowed to use it isn't an invite link, so
the people it invites type and verify one of those addresses, and none
of them registers without one.

Co-Authored-By: Devon Hudson <devon.dmytro@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJYpWHZUTqexCFxqUAq
2026-11-10 01:01:46 +00:00
Devon HudsonandClaude b75883927f Add POST /api/admin/v1/user-registration-tokens/invite-emails
The endpoint emails the invite links of registration tokens minted
through the token API: to the token's own address, or to one given for
a token without an address. The links are only ever mailed, so the
response carries a count rather than the links.

Everything is checked before anything is scheduled, so a rejected
request sends no email at all: each token must exist and be valid, and
an address given for a token with one must be the token's, ignoring
case. A token and address given more than once, ignoring case, are
emailed once. The sends are spread 100 ms apart, so a large batch
doesn't burst against the SMTP server.

The caller sends the room name and the inviter on the inviter's behalf,
so the endpoint doesn't trust them. The room name and the inviter's
display name are stripped of control characters, including the
bidirectional controls `char::is_control` misses, and truncated before
they are stored in the job payload. The inviter's Matrix ID is never
truncated, so it can't show a server it isn't from: it is kept whole if
it is valid under the historical grammar, and left out otherwise.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJbETzs7DLgqpMfkYtG
2026-11-10 00:59:45 +00:00
Devon HudsonandClaude Opus 5.5 fc4fe8efdc Replace a registration token's allowed email addresses
`PUT /api/admin/v1/user-registration-tokens/{id}` takes `allowed_emails`,
which replaces the whole list, with the checks it gets when minting, and
null removes it. A token pinning an email, or one that isn't
passwordless, can't get a list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-10 00:59:45 +00:00
Devon HudsonandClaude Opus 5.5 6a97b7d13e Take allowed email addresses when minting a registration token
`allowed_emails` lists the addresses that may register with the token.
Each must be an address the registration policy accepts, as a pinned
email must, and repeats in another case are dropped. A token pins an
email or lists addresses, not both, and only a passwordless token
lists them. The admin API shows the list on every token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-10 00:59:45 +00:00
Devon HudsonandClaude Opus 5.5 52437ff8e3 Let a registration token's username be a template
A token's `username` containing `{` is a minijinja template, rendered
when registering with `random` set to 32 lowercase letters and digits.
Localparts can't contain `{`, so no username a token could otherwise
pin is read as one.

Adding a token checks a template by rendering it with a sample `random`,
in strict mode so an unknown variable is an error rather than an empty
string, and runs the registration policy on the result. A template that
doesn't render is a 400 carrying the render error. The name a template
renders to is only known when registering, so the username-taken check
applies to literal usernames only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-10 00:59:31 +00:00
Devon HudsonandClaude f5ea2a4349 Store a continue URL on registration tokens
A registration token can now carry a URL, for its link to send the user
to once they have registered or signed in. The admin API takes
`continue_url` when adding a token and reports it on every token. It
refuses anything but an http or https URL, and keeps the URL as given.

MAS doesn't read the URL. Whoever mints the token decides where it
leads, such as a room in a web client, or a page that lets the user
pick a client.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJbETzs7DLgqpMfkYtG
2026-11-10 00:59:31 +00:00
Devon HudsonandClaude Opus 5.5 e5381153c9 Report a token's invite_url in the admin API
Every registration token the admin API returns now carries `invite_url`,
the `/register?token=…` link which opens the registration page with that
token, so that an admin client can hand it to the invitee as is. The
token endpoints take the `UrlBuilder` to build it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-06 20:20:03 +00:00
Devon HudsonandClaude Opus 5.5 076673b73d Add a passwordless flag to registration tokens
A registration token can now be marked `passwordless`, which will let the
user register without picking a password: their identity is established
by verifying their email address instead. The admin API takes the flag
when creating a token and reports it on every token it returns, and
`manage issue-user-registration-token` takes `--passwordless`.

This only stores the flag; the registration flow doesn't use it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-06 19:47:40 +00:00
Devon HudsonandClaude Opus 5.5 ba7a1d1492 Add a username and an email address to registration tokens
A registration token can now carry the username and the email address
the account registered with it has to use. The admin API takes both when
creating a token and reports them on every token it returns, and
`manage issue-user-registration-token` takes `--username` and `--email`.

The admin API checks the pins when a token is created, so that it
doesn't mint a token nobody can register with: a pinned email must
parse, both must pass the registration policy, and a pinned username
must not be taken already.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-06 19:36:59 +00:00
Kai A. Hiller 5647b8a8a4 Update schema 2026-08-07 02:08:51 +02:00
Quentin Gliech 406d678a6f Add a filter[human-account-name] param to the upstream OAuth links admin API
Fuzzy (case-insensitive substring) search on the link's human account
name.
2026-07-27 16:09:01 +02:00
Quentin Gliech e40f5f97ec Regenerate config/API/policy schemas for schemars 1.0 + aide 0.16
Mechanical output changes from the dependency bump:
- aide 0.16 strips redundant null branches from optional query-param schemas
  (optionality stays expressed via required:false on the parameter).
- schemars 1.0 changes doc-comment dedenting, emits the ClientsConfig newtype as
  a named definition, and simplifies generic schema names
  (e.g. JsonWebKeySet_for_JsonWebKeyPublicParameters -> JsonWebKeySet).
2026-07-01 17:09:26 +02:00
Quentin Gliech fe622331a8 Admin API: allow listing and viewing of OAuth 2.0 clients (#5710) 2026-06-17 17:44:34 +02:00
Quentin Gliech 78036a933d Fix the compat session API definition in the admin API spec (#5714) 2026-06-17 17:42:31 +02:00
Quentin Gliech d33577cf4d Admin API: filter users based on client usage (#5707) 2026-06-17 17:12:56 +02:00
Quentin Gliech 9464ca8038 Merge branch 'main' into quenting/admin-api/session-time-filters 2026-06-17 17:01:02 +02:00
Quentin Gliech a8ffce8f13 Admin API: allow filtering OAuth 2.0 sessions by multiple clients (#5708) 2026-06-17 16:40:53 +02:00
Quentin Gliech 632d64d199 Per-provider registration token requirement (#5605) 2026-06-10 10:05:46 +02:00
Quentin Gliech 6c330ec72e Fix the compat session API definition in the admin API spec 2026-06-02 10:22:28 +02:00
Quentin Gliech 5104bb84d1 admin-api: filter OAuth2 client list by presence of active sessions 2026-06-01 17:30:16 +02:00
Quentin Gliech a5a957b0e3 admin-api: filter OAuth2 client list by grant type 2026-06-01 17:30:16 +02:00
Quentin Gliech 25a3e24d8c admin-api: expose grant_types on OAuth2 client model 2026-06-01 17:30:16 +02:00
Quentin Gliech b00af1b732 admin-api: add get endpoint for OAuth2 clients 2026-06-01 17:30:16 +02:00
Quentin Gliech 4d5e7c7984 admin-api: filter browser session list by last activity 2026-06-01 17:30:15 +02:00
Quentin Gliech bb4c8b66d3 admin-api: add list endpoint for OAuth2 clients 2026-06-01 17:30:15 +02:00
Quentin Gliech 77e84e7f86 admin-api: filter browser session list by creation time 2026-06-01 17:30:15 +02:00
Quentin Gliech 6a92be40d3 admin-api: filter compat session list by last activity 2026-06-01 17:30:15 +02:00
Quentin Gliech c5555b83b8 admin-api: filter compat session list by creation time 2026-06-01 17:30:15 +02:00
Quentin Gliech 31797b4b7c admin-api: filter OAuth2 session list by last activity 2026-06-01 17:30:15 +02:00
Quentin Gliech 45b0a59a09 admin-api: filter OAuth2 session list by creation time 2026-06-01 17:30:15 +02:00
Quentin Gliech ce68d63adb admin-api: allow filtering OAuth2 sessions by multiple clients
Make `filter[client]` on `GET /api/admin/v1/oauth2-sessions` repeatable
so admin tooling can fetch sessions belonging to a set of clients in
one request. The field on `FilterParams` changes from `Option<Ulid>`
to `Vec<Ulid>`; the struct was already extracted with
`axum_extra::extract::Query` so the repeated values are not silently
dropped.

Each client ULID is validated to exist (mirroring the previous
single-client `404` behaviour) before being passed to the new
`OAuth2SessionFilter::for_clients` storage filter. The `Display`
impl used to reconstruct cursor links now emits one
`filter[client]=…` segment per client so pagination preserves the
filter. The OpenAPI schema is regenerated via `misc/update.sh` and
now describes the parameter as an array.
2026-06-01 17:30:14 +02:00
Quentin Gliech 4be94f54bb admin-api: filter user list by presence of active OAuth2 session 2026-06-01 17:30:14 +02:00
Quentin Gliech ee9a7ccaef admin-api: filter user list by presence of active compat session
Adds `filter[has-active-compat-session]=true|false` to
`GET /api/admin/v1/users`. When `true` (resp. `false`), only users with
(resp. without) at least one active (non-finished) compatibility session
are returned.
2026-06-01 17:30:14 +02:00
Quentin Gliech be96582e9e admin-api: filter user list by active OAuth2 session with given clients
Adds `filter[active-oauth2-client]` to `GET /api/admin/v1/users`. The
filter is a repeatable ULID query parameter; the semantics are OR across
the supplied clients (a user matches if they have an active OAuth2
session belonging to any of them).

Each supplied client ID is validated up front: a missing client returns
404 (mirroring the pattern in `oauth2-sessions/list`).
2026-06-01 17:30:14 +02:00
defaultdino ba72443627 fix style, run update.sh and fix test for SiteConfig 2026-05-13 13:27:23 +02:00
mcalinghee a39edc9bd3 add displayname and avatar url when adding user with admin api 2026-05-09 14:33:58 +02:00
defaultdino 7342218175 fix provider.rs, format, and run update.sh 2026-04-03 19:22:57 +02:00
Quentin Gliech a35cb76c41 Remove the nullable transform 2025-11-07 10:53:46 +01:00
Quentin Gliech e2490688a5 Merge remote-tracking branch 'origin/main' into quenting/schemars-0.9 2025-11-06 17:34:43 +01:00
Olivier 'reivilibre dda3a498b3 (update JSONSchema) 2025-10-21 12:16:45 +01:00
Olivier 'reivilibre 1030ec9ea9 Add personal sessions admin API 2025-10-20 14:51:40 +01:00
Quentin Gliech cd39513d44 Add admin APIs to finish individual sessions (#5091) 2025-10-08 10:30:22 +02:00