Commit Graph
331 Commits
Author SHA1 Message Date
Devon HudsonandClaude Opus 5.5 40c316ca29 Hide the upstream providers on an invite registration
A registration token which is passwordless and pins both a username and
an email address is an invite for one person. Its registration form
offered the upstream providers too, so an external invitee could pick
the company's single sign-on by mistake. The form now offers none for
an invite. The sign-in link stays, and the sign-in page keeps its own
providers, for an invitee who already has an account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZdGaj9bJcn5QeeUw8YXoF
2026-10-13 15:30:54 +02:00
Quentin Gliech 426c3b2a33 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
the email verification code instead.

This only adds the column and plumbs it through the storage layer and the
admin API; the registration flow itself is unchanged for now.
2026-10-13 15:30:54 +02:00
Quentin Gliech d765af146d Add username and email columns to registration tokens
A registration token can now optionally carry the username and/or the email
address the account it is used for has to be registered with. This only adds
the columns and plumbs them through the storage layer and the CLI; nothing
enforces them yet.
2026-10-13 15:30:54 +02:00
Quentin Gliech 2d3bf03d63 Upgrade to rand 0.10 and the next RustCrypto generation
`rand` 0.10 and the new RustCrypto generation both build on `rand_core`
0.10, so they have to move together:

 - `rand`, `rand_chacha` and `rand_core` 0.10
 - `digest` 0.11, `sha2` 0.11, `hmac` 0.13, `const-oid` 0.10
 - `elliptic-curve` 0.14, `ecdsa` 0.17, `p256`, `p384` and `k256` 0.14,
   `signature` 3
 - `der`, `spki` and `sec1` 0.8, `pkcs8` 0.11, `pem-rfc7468` 1.0
 - `rsa` 0.10.0-rc.19 and `pkcs1` 0.8.0-rc.5, which have no stable
   release yet. They are pinned exactly, because release candidates
   break their API between releases.
 - `argon2` 0.6 and `pbkdf2` 0.13

On the `rand` side, `RngCore` becomes `Rng` and the old `Rng` becomes
`RngExt`. `gen_*` becomes `random_*`, `thread_rng` becomes `rng`,
`distributions` becomes `distr`, and `from_rng` can no longer fail. On
the crypto side, `mas-jose` and `mas-keystore` move to `BoxedUint` for
RSA, to the `pkcs1` and `pkcs8` reference types, and to the `Generate`
trait for key generation, and `mas-jose` no longer depends on
`generic-array`. Password hashing goes through `hash_password_with_rng`.

Stored data is unaffected. The password hashing snapshots are unchanged,
so bcrypt, Argon2 and PBKDF2 produce the same hashes for the same input
and salt, and `pbkdf2` 0.13 keeps the same defaults (SHA-256, 600 000
rounds). The keystore snapshots change only because keys generated from
a seeded RNG differ. The snapshots of keys loaded from files are
unchanged.

`opa-wasm` 0.3.3 already uses this generation, so most of the duplicate
crates it pulled in go away. The `deny.toml` skip list now names what
still pulls the older versions: cookie, sqlx, headers, wasmtime and pest
for RustCrypto, and opentelemetry_sdk, sentry and ulid for `rand` 0.9.
2026-10-09 15:42:26 +02:00
Hugh Nimmo-Smith ada65be990 Doc clarifications 2026-09-18 16:06:21 +01:00
Hugh Nimmo-Smith 2fd58b9f41 Improve usability of user code during device code flow
Use Crockford Base32 alphabet with O/0 and I/L/1 folding. Also help the browser to prompt for correct input.

The current alphabet gave 29.7 bits of entropy (it was random 0-9a-zA-Z which was then mapped to 0-9A-Z) whereas the new encoding is 30 bits.
2026-09-14 16:35:31 +01:00
defaultdino 7eadb518e9 remove AuthorizationGrantStage branch. remove browser_session_id from Exchanged state 2026-07-22 11:30:42 +02:00
defaultdino 2576ba3a13 defer oauth2 session creation to happen at token exchange time 2026-07-02 15:45:14 +02:00
Quentin Gliech 5d489f71e9 Infer an initial name for the device for the device auth grant (#5750) 2026-06-25 18:34:46 +02:00
Quentin Gliech 401b1e299b Persist the browser locale on the device code grant
Capture the preferred language from the browser view which accepts the
device code grant and store it on the grant, so it can later be used to
render a human-readable device name.
2026-06-23 10:26:07 +02:00
Quentin Gliech 6491ded8c1 Migrate all the ULID generations to use the extension trait 2026-06-22 14:46:55 +02:00
Quentin Gliech 6b390a3d5d Introduce an extension trait to generate ULIDs with our own datetime and randomness
This adds a new trait to help generate ULIDs with `chrono::DateTime` and the
workspace-level `rand` crate. This is to help decouple `rand` and `ulid`
upgrades from  each other.
2026-06-22 14:46:55 +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 eb0ef6380c Merge branch 'main' into quenting/upstream-pass-parameters 2026-06-17 14:54:37 +02:00
Quentin Gliech 632d64d199 Per-provider registration token requirement (#5605) 2026-06-10 10:05:46 +02:00
Quentin Gliech bb4c8b66d3 admin-api: add list endpoint for OAuth2 clients 2026-06-01 17:30:15 +02:00
Quentin Gliech 3025708520 Add a configuration option to disable device code auto-fill 2026-05-28 13:30:25 +02:00
Eric Eastwood fa23689962 #[allow -> #[expect 2026-05-21 16:37:47 -05:00
Quentin Gliech 11d68cc8c9 Merge branch 'main' into quenting/upstream-pass-parameters 2026-05-20 10:14:00 +02:00
Eric Eastwood 404a266b0e Merge branch 'main' into madlittlemods/max-session-threshold 2026-05-14 14:59:20 -05:00
Quentin Gliech aecb172209 Add oauth.device_code_grant_enabled configuration option (#5612) 2026-05-13 21:40:02 +02:00
Quentin Gliech 33624b63de Persist raw downstream query parameters on oauth2_authorization_grants
Captures the raw query parameters from the downstream OAuth2 authorization
request, so they can later be referenced from templated upstream
authorization parameters. Existing call sites pass an empty map; a
follow-up commit will wire the downstream authorization handler to
to capture the real query parameters.
2026-05-13 17:42:32 +02:00
adis veletanlic 7ab9e0f518 Merge branch 'main' into upstream-oauth-registration-token 2026-05-13 15:12:18 +02:00
defaultdino 5eae746361 format 2026-05-13 13:30:48 +02:00
defaultdino ba72443627 fix style, run update.sh and fix test for SiteConfig 2026-05-13 13:27:23 +02:00
defaultdino 3f57a9c8c7 resolve comments related to deprecation and transitioning 2026-05-13 13:17:51 +02:00
Eric Eastwood ce3cfe73d9 Pass through max_session_threshold 2026-05-08 13:45:08 -05:00
Eric Eastwood 8ab60954cf Rename option dangerous_hard_limit_eviction 2026-04-24 19:12:58 -05:00
Eric Eastwood 9b3e78909a Fix cargo doc not being able to resolve ExperimentalSessionLimitConfig
Fix https://github.com/element-hq/matrix-authentication-service/pull/5607#discussion_r3047813509
2026-04-09 16:58:08 -05:00
Hugh Nimmo-Smith 53e6d05f40 Add oauth.device_code_grant_enabled configuration option 2026-04-07 11:13:56 +01:00
Eric Eastwood 5532c0cda9 Better rustdoc links 2026-04-03 17:42:09 -05:00
defaultdino 407f3cb4fa distinguish password vs upstream oauth registration token requirements 2026-04-03 17:41:37 +02:00
Tonkku 673392fcc8 Support MSC4198 login_hint in account management uri 2026-02-23 13:06:59 +02:00
Quentin Gliech e1de5c5860 Simplify the consent screen (#5310) 2025-12-03 14:22:14 +01:00
Quentin Gliech 9213a1ebcc Get the display name of the Matrix user on the consent screens 2025-12-02 17:51:23 +01:00
Quentin Gliech df14076dd0 Merge branch 'quenting/upstream-oauth/better-conflict-options' into quenting/upstream-oauth/skip-interactive 2025-11-28 18:08:09 +01:00
Quentin Gliech 47d411f641 Option to skip confirmation when registering through an upstream OAuth provider 2025-11-28 15:51:43 +01:00
Quentin Gliech ffb86f6558 Add more options to deal with localpart conflicts on upstream OAuth 2.0 logins 2025-11-28 10:53:28 +01:00
Quentin Gliech 4b6c1db5a2 Unify registrations for local passwords and upstream OAuth registrations (#5281) 2025-11-27 16:13:03 +01:00
Quentin Gliech ac4f66920c Store upstream OAuth sessions on user registrations
This will allow us creating user registrations from upstream OAuth auth
sessions
2025-11-21 19:31:37 +01:00
Olivier 'reivilibre 604ed545b0 Use NonZeroU64 2025-11-06 15:01:49 +00:00
Olivier 'reivilibre 87c897c51a Add configuration for session limiting 2025-11-06 10:12:14 +00:00
Olivier 'reivilibre 3d80097bae Merge branch 'main' into rei/pat_devicesync 2025-10-22 14:27:40 +01:00
Olivier 'reivilibre c8ed12512e Relax the validity check of the token actor 2025-10-22 13:15:12 +01:00
Olivier 'reivilibre 42f6664396 When adding or revoking personal sessions, schedule needed device syncs 2025-10-22 11:50:27 +01:00
reivilibre 477385fd9f Add storage for Personal Access Tokens (#5106)
Defines a token format for PATs and implements the base storage functionality for PATs and 'Personal Sessions' which are conceptually the parent containers of PATs.

Personal Sessions survive across regenerations of PATs and are the entities associated with the device ID. In virtually every way they are functionally the same as Compat or OAuth2 Sessions.
2025-10-09 13:07:41 +01:00
Olivier 'reivilibre 72d3ea851b Support OAuth2 clients as owners of personal sessions 2025-10-07 19:54:59 +01:00
Quentin Gliech e4844968d3 Add a configuration option to make email optional for password registration 2025-10-07 17:28:01 +02:00
Olivier 'reivilibre b54a657c32 data model: Add personal sessions with mpt_ prefix 2025-10-07 16:08:43 +01:00
Quentin Gliech 377ef1d390 Inject the version in the app state 2025-10-03 11:41:22 +02:00