Class: Gitlab::Auth::Otp::Strategies::FortiAuthenticator::PushOtp

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/auth/otp/strategies/forti_authenticator/push_otp.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Auth::Otp::Strategies::Base

Instance Method Details

#validateObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/auth/otp/strategies/forti_authenticator/push_otp.rb', line 9

def validate
  response = Gitlab::HTTP.post(
    auth_url,
    headers: { 'Content-Type': 'application/json' },
    body: body.to_json,
    basic_auth: api_credentials)

  # Successful authentication results in HTTP 200: OK
  # Push - https://docs.fortinet.com/document/fortiauthenticator/6.2.1/rest-api-solution-guide/943094/push-authentication-pushauth
  response.ok? ? success : error_from_response(response)
rescue StandardError => ex
  Gitlab::AppLogger.error(ex)
  error(ex.message)
end