vikunja/pkg/modules/auth
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
..
ldap fix(auth): skip profile updates for disabled LDAP users 2026-03-23 16:37:26 +00:00
oauth2server feat(audit): emit the login event for the OAuth code exchange 2026-06-12 08:56:08 +00:00
openid fix(auth): match OIDC username fallback on preferred_username as well as subject 2026-06-19 16:31:34 +02:00
auth.go refactor(auth): extract transport-agnostic login, logout and OIDC cores 2026-06-17 19:43:41 +00:00
auth_test.go feat(auth): add GetAuthFromContext for Huma handlers 2026-05-31 12:56:57 +00:00