vikunja/pkg/modules/auth/openid
kolaente 0a407e5656 fix(auth): match OIDC username fallback on preferred_username as well as subject
When the username fallback is enabled, the local account lookup only matched
the local username against the OIDC `sub` claim. For providers that issue an
opaque, random `sub` (e.g. PocketID's UUID), this never matched a real local
username, so a duplicate user was created instead of linking the existing
local account.

The fallback now tries the `sub` first (preserving today's behaviour for IdPs
where sub == username) and, if no match is found, the `preferred_username`
claim (normalized the same way user creation normalizes it). When EmailFallback
is also enabled, the email continues to be ANDed with each username candidate.

Configuring an OIDC provider already delegates trust to it, and the username
fallback is an admin-enabled opt-in, so matching the admin-trusted
`preferred_username` is appropriate; `sub` matching is kept for backward
compatibility.

Fixes #2705
2026-06-19 16:31:34 +02:00
..
cron.go fix: add missing Commit() to write callers 2026-02-25 11:03:02 +01:00
main_test.go feat: move to slog for logging 2025-07-21 18:15:39 +02:00
openid.go fix(auth): match OIDC username fallback on preferred_username as well as subject 2026-06-19 16:31:34 +02:00
openid_test.go fix(auth): match OIDC username fallback on preferred_username as well as subject 2026-06-19 16:31:34 +02:00
providers.go fix(auth): tolerate string booleans in oidc provider config (#2599) 2026-04-11 19:10:26 +00:00
providers_test.go test(auth): cover env-var string booleans for oidc providers (#2599) 2026-04-11 19:10:26 +00:00