forgejo/models/auth
Gusted 23e6ca0415
fix(sec): consider webauthn for external login
- Currently during external login (such as OAuth2), if the user is
enrolled into Webauthn and not enrolled into TOTP then no 2FA is being
done during external login and when account linking is set to `auto` then
also during automatic linking. This results in bypassing the 2FA of the
user.
- Create a new unified function that checks if the user is enrolled into
2FA and use this when necessary. Rename the old `HasTwoFactorByUID`
function to `HasTOTPByUID` which is a more appropiate naming.

(cherry picked from commit df5d656827)

Conflicts:
  the original commit was trimmed down to be fit for backport
2025-05-02 07:39:14 +02:00
..
TestOrphanedOAuth2Applications test: Global OAuth should not be deleted 2024-11-23 22:48:34 +00:00
access_token.go Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
access_token_scope.go [GITEA] silently ignore obsolete sudo scope 2024-02-05 16:05:50 +01:00
access_token_scope_test.go [GITEA] silently ignore obsolete sudo scope 2024-02-05 16:05:50 +01:00
access_token_test.go enable linter testifylint on v7 (#4572) 2024-07-30 19:42:06 +00:00
auth_token.go fix: extend forgejo_auth_token table 2024-11-15 12:02:14 +01:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
oauth2.go fix: Do not delete global Oauth2 applications 2024-11-23 22:48:34 +00:00
oauth2_list.go Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
oauth2_test.go Update golang packages to v1.23 (v7.0/forgejo) (minor) (#7081) 2025-03-04 22:15:29 +00:00
session.go Fix session key conflict with database keyword (#28613) 2023-12-27 15:24:23 +08:00
session_test.go enable linter testifylint on v7 (#4572) 2024-07-30 19:42:06 +00:00
source.go remove util.OptionalBool and related functions (#29513) 2024-03-06 12:10:46 +08:00
source_test.go enable linter testifylint on v7 (#4572) 2024-07-30 19:42:06 +00:00
two_factor.go fix(sec): consider webauthn for external login 2025-05-02 07:39:14 +02:00
two_factor_test.go fix(sec): consider webauthn for external login 2025-05-02 07:39:14 +02:00
twofactor.go fix(sec): consider webauthn for external login 2025-05-02 07:39:14 +02:00
webauthn.go Move more functions to db.Find (#28419) 2024-01-15 02:19:25 +00:00
webauthn_test.go enable linter testifylint on v7 (#4572) 2024-07-30 19:42:06 +00:00