What Beffroi OP includes: OpenID Connect and SAML 2.0 on the same users and sessions, passkeys and multi-factor authentication, FAPI 2.0, key management, encryption at rest and logout, with a diagram for each.
One Symfony application serves the pages, the endpoints, the console and the background jobs. The protocol rules live in pure PHP packages with no dependency on HTTP.
Fig. 01 Users, client applications and SAML partners talk to one application, beffroi/op, one image on FrankenPHP. The identity core holds the users, their credentials, their sessions, their groups and the keys; the two protocols are packages of their own beside it. For what runs next to the application, PostgreSQL and the key management service, see Fig. 02.
Beffroi OP ships as a Docker image and a compose file that run the server, its worker and PostgreSQL next to the key management service you configure. Without one, the sodium backend seals the keys with a key generated once into a file. The same application runs from its source, on your own PHP 8.4 runtime and web server.
Fig. 02 The server answers browsers and applications. The worker calls clients back, writes the audit log and runs the scheduled jobs. Both run from the same image, ghcr.io/beffroi-auth/op, share PostgreSQL, and ask the key management service to open the keys they use.
The image is built for amd64 and arm64, runs its two processes as an unprivileged user, terminates TLS itself or hands it to the proxy in front of it, and reads its whole configuration from the environment.
Browsers sign in with the authorization code flow and PKCE. The implicit and password grants are not served.
Fig. 03 The application sends the browser to Beffroi with a PKCE challenge. The user authenticates, Beffroi sends the browser back with a code, and the application exchanges that code for tokens with its verifier.
The sign-in and consent pages carry the name, the logo and the two colours of the tenant, in English and in French, in light and in dark mode.
Beffroi acts as a SAML identity provider and as a SAML service provider. Both roles share the users and sessions of OpenID Connect: a browser signed in through one protocol is signed in for the other, and logout applies to both.
Identity provider for your applications
An application that speaks SAML authenticates its users with Beffroi: a SimpleSAMLphp or Shibboleth service provider, a product that requires a SAML identity provider, Microsoft Entra ID federating its guests.
Fig. 04 The application sends the browser to Beffroi with an authentication request. Beffroi authenticates the user, or reuses the session already open, and posts a signed assertion back, which the application verifies against the metadata of Beffroi.
Service provider for an organisation
The users of an organisation sign in through the organisation's own identity provider, discovered from their email domain. The account is created at first sign-in with its groups mapped, and never holds a local password.
Fig. 05 The domain of the address selects the identity provider. The user signs in there, the assertion comes back to Beffroi, and the browser returns to the application that was waiting.
For clients that require the financial-grade profile: authorization requests pushed or signed, responses signed, and tokens bound to the client's key or certificate, on the same endpoints as every other client.
Fig. 06 Pushed authorization requests and signed request objects on the way in, signed responses on the way out, and tokens bound with DPoP or mutual TLS.
Client credentials for services, device authorization for devices without a keyboard, CIBA for approval on another device, and token exchange for gateways acting on behalf of a caller.
Fig. 07 A service with no user behind it, a device with no keyboard, a user who approves on their own device, a gateway acting for its caller: each one has its grant, and each one ends with an access token.
The master key stays in your key management service. Signing keys are generated in the process, sealed, and only then written to disk: a copy of the database and of the files is unreadable without the service.
Fig. 08 The key management service seals each signing key. The provider opens it once per process, publishes its public part in the JWK Set and signs with its private part.
Key rotation
The next key is published before it signs, and the previous one stays published until the last token it signed has expired, so that clients never receive a token they cannot verify. A compromised key is removed immediately.
Names, addresses and session origins are encrypted in their column under a data key of the tenant. A test scans a dump of the database byte by byte and fails if it finds a value in clear.
Fig. 09 A data key per tenant and per family of columns, wrapped by the key management service, seals each personal column. A lookup that must still work, such as a sign-in by username, matches a blind index.
When a session ends, its tokens are revoked and every application signed in under it is notified, whichever protocol it uses.
Fig. 10 The end of a session revokes its refresh tokens and removes its opaque access tokens, notifies the other clients through the browser or server to server, and logs out each SAML service provider of the session.
Users manage their own account: profile, passkeys and codes, sessions, consents, and an export of everything the provider holds about them. The audit log records who did what, when and from where, with a retention period set by the deployment.