Class: Gitlab::ExternalAuthorization::Client

Inherits:
Object
  • Object
show all
Includes:
Config
Defined in:
lib/gitlab/external_authorization/client.rb

Constant Summary collapse

REQUEST_HEADERS =
{
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}.freeze

Instance Method Summary collapse

Methods included from Config

#client_cert, #client_key, #client_key_pass, #enabled?, #has_tls?, #perform_check?, #service_url, #timeout

Constructor Details

#initialize(user, label) ⇒ Client

Returns a new instance of Client.


15
16
17
# File 'lib/gitlab/external_authorization/client.rb', line 15

def initialize(user, label)
  @user, @label = user, label
end

Instance Method Details

#request_accessObject


19
20
21
22
23
24
25
26
27
# File 'lib/gitlab/external_authorization/client.rb', line 19

def request_access
  response = Gitlab::HTTP.post(
    service_url,
    post_params
  )
  ::Gitlab::ExternalAuthorization::Response.new(response)
rescue *Gitlab::HTTP::HTTP_ERRORS => e
  raise ::Gitlab::ExternalAuthorization::RequestFailed.new(e)
end