Class: LogaltyCertificateIssuanceApiCerty::BearerAuth

Inherits:
CoreLibrary::HeaderAuth
  • Object
show all
Includes:
CoreLibrary
Defined in:
lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb

Overview

Utility class for OAuth 2 authorization and token management.

Instance Method Summary collapse

Constructor Details

#initialize(bearer_auth_credentials) ⇒ BearerAuth

Initialization constructor.



17
18
19
20
21
22
23
24
# File 'lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb', line 17

def initialize(bearer_auth_credentials)
  auth_params = {}
  @_access_token = bearer_auth_credentials.access_token unless
    bearer_auth_credentials.nil? || bearer_auth_credentials.access_token.nil?
  auth_params[:Authorization] = "Bearer #{@_access_token}" unless @_access_token.nil?

  super auth_params
end

Instance Method Details

#error_messageObject

Display error message on occurrence of authentication failure.



12
13
14
# File 'lib/logalty_certificate_issuance_api_certy/http/auth/bearer_auth.rb', line 12

def error_message
  'BearerAuth: access_token is undefined.'
end