summaryrefslogtreecommitdiff
path: root/app/services/users/validate_push_otp_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/users/validate_push_otp_service.rb')
-rw-r--r--app/services/users/validate_push_otp_service.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/services/users/validate_push_otp_service.rb b/app/services/users/validate_push_otp_service.rb
new file mode 100644
index 00000000000..6a914cda28c
--- /dev/null
+++ b/app/services/users/validate_push_otp_service.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module Users
+ class ValidatePushOtpService < BaseService
+ include ::Gitlab::Auth::Otp::Fortinet
+
+ def initialize(current_user)
+ @current_user = current_user
+ @strategy = if forti_authenticator_enabled?(current_user)
+ ::Gitlab::Auth::Otp::Strategies::FortiAuthenticator::PushOtp.new(current_user)
+ end
+ end
+
+ def execute
+ strategy.validate
+ rescue StandardError => ex
+ Gitlab::ErrorTracking.log_exception(ex)
+ error(ex.message)
+ end
+
+ private
+
+ attr_reader :strategy
+ end
+end