Checkin is one Laravel 13 application with three faces:
| Face | Who | Where | Built with |
|---|---|---|---|
| Account & launcher | every person | /login, /dashboard, /settings/* | Fortify + Livewire 4 + Flux (Laravel's Livewire starter kit) |
| Identity provider | applications | /oauth/*, /.well-known/openid-configuration | Laravel Passport 13 + app/Oidc |
| Administration | administrators | /admin/* | Livewire 4 single-file pages + Flux, inside the same sidebar |
| Updates | administrators | /admin/updates, app:update | app/Updates, shared with Boogle, Hackly and IndieStats |
Decisions#
OpenID Connect, not SAML (and not "just OAuth")#
- Every application here is a Laravel app (or a modern self-hosted tool: Grafana, Portainer, Gitea, Nextcloud… all speak OIDC). OIDC gives a signed ID token that states who signed in, which plain OAuth 2.0 does not.
- One protocol means one client package, one set of tests, one set of endpoints to secure.
- SAML 2.0 is only worth it for enterprise suites that cannot do OIDC (some SaaS, older Google Workspace / AWS SSO setups). If that day comes,
codegreencreative/laravel-samlidpcan be added next to Passport without touching the account side; theUsermodel already has a stableuuidto use as NameID.
Passport as the OAuth server, a thin OIDC layer on top#
Passport provides clients, authorization codes, access/refresh tokens, PKCE, scopes, the consent screen and the token endpoint, with a well-tested league/oauth2-server underneath. It lacks OIDC, so app/Oidc adds exactly what is missing:
| Class | Role |
|---|---|
AuthorizationRequest | league's request + the nonce |
AuthCodeGrant | reads nonce from /oauth/authorize, stores it in the encrypted code payload, hands it to the response at /oauth/token |
IdTokenResponse | Passport's bearer response + id_token when the openid scope was granted |
IdTokenBuilder / Claims | the claims per scope; signs with Passport's private key (firebase/php-jwt, already a Passport dependency) |
Keys | the public key as a JWK, the kid (RFC 7638 thumbprint) |
AccessToken | Passport's entity, serialised once so at_hash matches the token actually sent |
Concerns\RetrievesOidcAuthRequest | lets the consent controllers restore our request class from the session |
App\Providers\PassportServiceProvider extends Passport's provider to build the custom grant; composer.json disables Passport's auto-discovery so only this provider registers.
External identities as a door, not as accounts#
Sign-in with Google, GitHub and Microsoft (Laravel Socialite + socialiteproviders/microsoft) is optional and enabled per provider by its credentials. An external identity is a connection to an existing person (social_accounts), never a source of new accounts, and it stands in for the password only: SocialLoginController hands people with TOTP to Fortify's two-factor challenge exactly like RedirectIfTwoFactorAuthenticatable does, then answers with Fortify's LoginResponse, so the intended /oauth/authorize URL survives. Applications see no difference. Details and the reasoning in social-login.md.
Routes declared by hand#
Passport::ignoreRoutes() and routes/oauth.php re-declare the four Passport routes we use (token, authorize GET/POST/DELETE) so EnsureUserMayUseClient can protect /oauth/authorize, and add the OIDC endpoints. The file is loaded without the web group (see bootstrap/app.php): the token, JWKS, discovery and UserInfo endpoints stay stateless; the browser-facing ones add web explicitly. /oauth/logout is excluded from CSRF because applications POST to it from another origin.
One UI, one login#
The administration is a set of Livewire pages under the same layout and sidebar as the launcher and the settings; no second framework, no second CSS bundle, no second login. App\Http\Middleware\EnsureUserIsAdmin (alias admin) admits administrators who are not suspended; User::canAdminister() decides, and the sidebar shows the group only to them.
Access control at the door#
EnsureUserMayUseClient runs on /oauth/authorize:
- no user yet → let Passport send them to
/login(they come back afterwards); - unknown or disabled client → let Passport answer
invalid_client; - suspended person, or application restricted to assigned people without an assignment →
403page, access-log entry,error=access_deniedlink back to the app.
Consent is skipped for trusted applications (Client::skipsAuthorization()); Passport also skips it once the person already holds a valid token for the requested scopes.
How a sign-in travels#
- The person clicks Continue with Checkin in an app; the client package stores
state,nonceand a PKCE verifier in the app's session and redirects to/oauth/authorize?...&code_challenge=…&nonce=…. - Not signed in at Checkin? Fortify's login (password, passkey or security key, or a connected Google/GitHub/Microsoft account; then TOTP if enabled) and back.
EnsureUserMayUseClientchecks the person may use the app. Passport validates the request;AuthCodeGrantkeeps the nonce.- Trusted app (or prior consent) → an authorization code (encrypted JSON carrying client, user, scopes, PKCE challenge, nonce) is sent to the app's redirect URI with the
state. - The app posts the code and the PKCE verifier (plus its secret) to
/oauth/token.AuthCodeGrantverifies, issues the access and refresh tokens, andIdTokenResponseadds an RS256 ID token withsub= the person's UUID, the nonce,auth_time(last login) andat_hash. - The app verifies the ID token with
/oauth/jwks, fetches/oauth/userinfo, finds or creates its local user, logs them in. AccessTokenCreatedlands in the audit log with the person and the application.
Data model#
| Table | Notes |
|---|---|
users | starter-kit columns + uuid (public sub), role (admin/user), username, last_login_at, suspended_at, Fortify 2FA columns |
passkeys | laravel/passkeys credentials (one row per passkey or security key) |
social_accounts | Google/GitHub/Microsoft identities connected to a person: provider, provider_id (unique together), profile copy, last_used_at; no tokens |
oauth_clients | Passport + slug, description, launch_url, trusted, access (everyone/assigned), sort |
client_user | people assigned to restricted applications |
oauth_auth_codes, oauth_access_tokens, oauth_refresh_tokens | Passport |
access_logs | event, user_id, client_id, email, ip_address, user_agent, context, created_at |
App\Listeners\AccessLogSubscriber turns the authentication events of Laravel, Fortify, Passkeys and Passport into rows, and keeps users.last_login_at (used as auth_time).
Self-update#
app/Updates/Updater.php, UpdateState.php, UpdateFailed.php and app:update are copied verbatim from Boogle (identical in Hackly and IndieStats): keep them in sync across the four applications when one of them changes. config/updates.php points at this repository; VERSION holds the installed version; routes/console.php schedules app:update pending every minute and app:update apply --auto nightly. The Updates page is resources/views/pages/admin/⚡updates.blade.php, with admin/updates/status polled while an update runs.