Phase 12: signing in with the Core's Authelia

Admins make the client's secret under Settings → Sign-in, which shows the
entry for the Core's idproviders.yml (the secret's PBKDF2-SHA512 hash, the
redirect address, PKCE). People sign in with their Core account: invited
ones are matched by verified email, then by subject; optionally anyone at
the Core's domain joins. Passwords can be turned off but for the owner's,
and signing out ends the Core's session where it can. On multi-tenant, the
team is found by its proved domain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:00:36 -07:00
co-authored by Claude Opus 5.5
parent 637ef1cc25
commit 962dbe3286
19 changed files with 1458 additions and 15 deletions
+51 -7
View File
@@ -58,10 +58,9 @@ tools over MCP, approvals, limits and visibility, and the JSON API. Schema
with a Postgres schema per team (decided 2026-11-26); schema 42. Next is
Phase 14 (billing), or Phase 12 once the Core's `idproviders.yml` is in.
**Phase 12 (signing in with the Core, OIDC) is set aside for now**
(2026-11-26): before it starts, the user will share the Federated Core's
`idproviders.yml`, which shows how the Core sets up Authelia and its
clients. Still open: who adds Supermarket's client to Authelia. Phase 12 still needs who adds Supermarket's client to
**Phase 12 (signing in with the Core, OIDC) is built** on branch
`phase12`, which starts from `phase13` (2026-11-26), with the Core's
`idproviders.yml` as the guide. Not yet tried against a real Authelia. Phase 12 still needs who adds Supermarket's client to
Authelia.
**Coming back to it (for the agent working on it):**
@@ -2779,9 +2778,54 @@ itself (that answers the open question). The entries:
Authelia is always at `authelia.<Core domain>` (confirmed 2026-11-25), so
Supermarket fills in the issuer itself from the Core's domain. Still open:
whether the Core's developer adds Supermarket's client to Authelia, or the
Core's admin tooling does it.
Supermarket fills in the issuer itself from the Core's domain. Who adds the
client: the Core's admin, pasting Supermarket's entry into
`idproviders.yml` (2026-11-26).
**Built 2026-11-26** on branch `phase12` (from `phase13`). Parts 1–4; part 5
(groups to roles) stays for later.
- `internal/oidc`: discovery (the issuer must match), the code flow with
PKCE (S256), a nonce and a state, the token exchange
(`client_secret_post`), and the ID token's claims checked (issuer,
audience, expiry with two minutes' leeway, nonce). Its signature isn't:
the token comes straight from the token endpoint over TLS, which OpenID
Connect Core (3.1.3.7) allows instead; the userinfo endpoint completes
it. `HashSecret` makes Authelia's `$pbkdf2-sha512$310000$…` (checked
against Python's PBKDF2), `CheckHash` reads one.
- Schema 43 (the platform's): `users.oidc_subject` (`<issuer>|<subject>`,
unique) and `sessions.via` (password or core).
- Settings → Sign-in (admins, server and multi-tenant): the issuer
(`https://authelia.<Core domain>`, or another one typed in), the redirect
address (`https://<domain>/auth/core/callback`, the platform's on
multi-tenant), the client ID (`supermarket`), *Make the client's secret*
(kept encrypted in the team's secrets; only its hash shown), the entry
for `idproviders.yml` to copy (as the Core's other clients': implicit
consent, `one_factor`, PKCE S256, `openid profile email groups`, code
only, `client_secret_post`), *Test* (the discovery document; recorded on
Connections), and the switches below.
- The sign-in page offers *Sign in with <Core>* where it's on; on
multi-tenant, *Sign in with your Core* asks for the company's website and
uses the team that proved that domain (the team goes in the state).
Invitations offer it too.
- **Who may sign in**: someone invited, matched by the Core's *verified*
email the first time (an invitation is accepted that way), then by their
subject, even if their email changes. Turned off, or linked to another
Core account: refused. Optionally (*anyone at <Core domain>*), a new
person with a verified address at the Core's domain joins as a member
with the modules chosen. Failures and sign-ins are in the audit log.
Two-factor is Authelia's.
- **Password, Core, or both**: *Only with the Core* turns passwords off,
except the owner's (a way in if the Core is down); on multi-tenant, one
team that still takes a person's password is enough.
- **Signing out** of a session that came through the Core goes on to the
Core's end-session address, when its discovery document has one.
- Checked with a fake Authelia: the entry's hash matches the kept secret;
an invited person signs in and is activated; next time by subject; not
invited, unverified, a replayed or made-up state, all refused; Core-only
refuses a member's password but not the owner's; auto-join; sign-out
goes to the Core; and on multi-tenant (Postgres), the domain finds the
team and the session works there. Not tried against a real Authelia yet.
#### Phase 13: Multi-tenant