2026-01-02 13:41:09 +00:00
|
|
|
# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
2023-05-31 09:54:14 +00:00
|
|
|
|
|
|
|
|
class Auth::TwoFactor::AuthenticationMethod < Auth::TwoFactor::Method
|
|
|
|
|
include Mixin::RequiredSubPaths
|
|
|
|
|
|
2023-06-01 07:26:46 +00:00
|
|
|
# Implement it in the real method itself if you need it.
|
2024-01-29 18:07:33 +00:00
|
|
|
# This needs to be used for e.g. sending out emails or SMS.
|
2023-06-01 07:26:46 +00:00
|
|
|
def initiate_authentication; end
|
|
|
|
|
|
2023-05-31 09:54:14 +00:00
|
|
|
def verify(payload, configuration = user_two_factor_preference_configuration)
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
end
|
|
|
|
|
|
2023-06-01 07:26:46 +00:00
|
|
|
def initiate_configuration
|
2023-05-31 09:54:14 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def available?
|
|
|
|
|
true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def related_setting_name
|
|
|
|
|
"two_factor_authentication_method_#{method_name}"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def user_two_factor_preference
|
|
|
|
|
user&.two_factor_preferences&.authentication_methods&.find_by(method: method_name)
|
|
|
|
|
end
|
2025-02-14 08:36:02 +00:00
|
|
|
|
|
|
|
|
def without_client_config?
|
|
|
|
|
false
|
|
|
|
|
end
|
2023-05-31 09:54:14 +00:00
|
|
|
end
|