Class: Users::ValidatePushOtpService

Inherits:
BaseService show all
Includes:
Gitlab::Auth::Otp::Fortinet
Defined in:
app/services/users/validate_push_otp_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(current_user) ⇒ ValidatePushOtpService

Returns a new instance of ValidatePushOtpService.



7
8
9
10
11
12
# File 'app/services/users/validate_push_otp_service.rb', line 7

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

Instance Method Details

#executeObject



14
15
16
17
18
19
# File 'app/services/users/validate_push_otp_service.rb', line 14

def execute
  strategy.validate
rescue StandardError => ex
  Gitlab::ErrorTracking.log_exception(ex)
  error(ex.message)
end