P4-05: OIDC login (generic, JIT-provisioned) #16
Reference in New Issue
Block a user
Delete Branch "p4-05-oidc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
oidc.issuer,client_id,client_secret[_file],role_claimdefaultgroups,role_mapping,display_name,redirect_url). Empty issuer → routes not mounted.users.auth_source/oidc_subject(partial unique index),sessions.id_token,oidc_state(state+verifier round-trip, 5-min TTL, swept on alert tick).auth_source='oidc', blank password); returning users matched by stablesub, role + email refreshed every login. No role match → deny banner, no row created, audituser.oidc_login_blocked. Username collision with a local user → same deny path./logoutand, when the IdP advertisedend_session_endpoint, follows up with RP-initiated logout (id_token_hint+post_logout_redirect_uri); when not advertised it gracefully degrades to clearing the local session./login; oidc chip in the users list; edit page disables username/email/role for OIDC users with a server-side guard backing the UI./userinfoand folds claims in (Authelia and many other IdPs only putsubon the ID token); id_token claims remain authoritative on conflict.Test plan
go vet ./...+go test ./...green (oidc + http suites cover the four callback branches viaoidcteststub IdP)https://auth.dcglab.co.uk(screenshots in_diag/p4-05-sweep/):/settings/users/hosts/newsub(no duplicate)Confirmed claim name from the lab IdP is 'groups' (not 'roles' as the original spec assumed). Default the role_claim config field to 'groups' which also matches Keycloak and Authentik out of the box. Add a 'display_name' field so the SSO button can read 'Sign in with Authelia' rather than the generic 'SSO'. Two new gotchas captured: - Authelia 4.39+ 'sub' is an opaque UUID, not username — the locked design already keys on sub + reads preferred_username for display, so this is just documentation. - end_session_endpoint isn't always published (Authelia config- dependent); the locked logout flow already degrades cleanly.