diff options
Diffstat (limited to 'app/models/authentication_event.rb')
-rw-r--r-- | app/models/authentication_event.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/authentication_event.rb b/app/models/authentication_event.rb index ac6e08caf50..9d191e6ae4d 100644 --- a/app/models/authentication_event.rb +++ b/app/models/authentication_event.rb @@ -3,6 +3,12 @@ class AuthenticationEvent < ApplicationRecord include UsageStatistics + TWO_FACTOR = 'two-factor'.freeze + TWO_FACTOR_U2F = 'two-factor-via-u2f-device'.freeze + TWO_FACTOR_WEBAUTHN = 'two-factor-via-webauthn-device'.freeze + STANDARD = 'standard'.freeze + STATIC_PROVIDERS = [TWO_FACTOR, TWO_FACTOR_U2F, TWO_FACTOR_WEBAUTHN, STANDARD].freeze + belongs_to :user, optional: true validates :provider, :user_name, :result, presence: true @@ -17,6 +23,6 @@ class AuthenticationEvent < ApplicationRecord scope :ldap, -> { where('provider LIKE ?', 'ldap%')} def self.providers - distinct.pluck(:provider) + STATIC_PROVIDERS | Devise.omniauth_providers.map(&:to_s) end end |