Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Initial adding of WebAuthn as a strategy

Klaus Zanders44b2aa8237af
diff --git a/modules/two_factor_authentication/config/locales/en.yml b/modules/two_factor_authentication/config/locales/en.yml
index 5a5b38a9080..41d7da19bec 100644
--- a/modules/two_factor_authentication/config/locales/en.yml
+++ b/modules/two_factor_authentication/config/locales/en.yml
@@ -26,6 +26,7 @@ en:
two_factor_authentication/device: "2FA device"
two_factor_authentication/device/sms: "Mobile phone"
two_factor_authentication/device/totp: "Authenticator application"
+ two_factor_authentication/device/webauthn: "WebAuthn"
two_factor_authentication:
error_2fa_disabled: "2FA delivery has been disabled."
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb
new file mode 100644
index 00000000000..5763ffb6229
--- /dev/null
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb
@@ -0,0 +1,19 @@
+require 'webauthn'
+
+module OpenProject::TwoFactorAuthentication
+ module TokenStrategy
+ class Webauthn < Base
+ def self.supported_channels
+ [:webauthn]
+ end
+
+ def self.device_type
+ :webauthn
+ end
+
+ def self.identifier
+ :webauthn
+ end
+ end
+ end
+end
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb
index c1c20e274e6..fbee9242e14 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb
@@ -124,6 +124,7 @@ module OpenProject::TwoFactorAuthentication
def available_strategies
{
totp: I18n.t("activerecord.models.two_factor_authentication/device/totp"),
+ webauthn: I18n.t("activerecord.models.two_factor_authentication/device/webauthn"),
sns: I18n.t("activerecord.models.two_factor_authentication/device/sms"),
message_bird: I18n.t("activerecord.models.two_factor_authentication/device/sms")
}