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

#allow_deploy_tokens_and_deploy_keys?, #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
18
# File 'lib/gitlab/external_authorization/client.rb', line 15

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

Instance Method Details

#request_accessObject



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

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, e
end