authentication_method.rb 819 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. class Auth::TwoFactor::AuthenticationMethod < Auth::TwoFactor::Method
  3. include Mixin::RequiredSubPaths
  4. # Implement it in the real method itself if you need it.
  5. # This needs to be used for e.g. sending out emails or SMS.
  6. def initiate_authentication; end
  7. def verify(payload, configuration = user_two_factor_preference_configuration)
  8. raise NotImplementedError
  9. end
  10. def initiate_configuration
  11. raise NotImplementedError
  12. end
  13. def available?
  14. true
  15. end
  16. def related_setting_name
  17. "two_factor_authentication_method_#{method_name}"
  18. end
  19. def user_two_factor_preference
  20. user&.two_factor_preferences&.authentication_methods&.find_by(method: method_name)
  21. end
  22. def without_client_config?
  23. false
  24. end
  25. end