Class: MultiAuthSample::CustomAuth

Inherits:
CoreLibrary::HeaderAuth
  • Object
show all
Defined in:
lib/multi_auth_sample/http/auth/custom_auth.rb

Overview

Utility class for custom authorization.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ CustomAuth

Initialization constructor.



19
20
21
22
23
24
25
26
27
28
# File 'lib/multi_auth_sample/http/auth/custom_auth.rb', line 19

def initialize(config)
  auth_params = {}

  # TODO: Add your custom authentication here
  # The following properties are available to use
  # auth_params['accessToken'] = config.access_token

  super auth_params
  @_config = config
end

Instance Method Details

#error_messageObject

Display error message on occurrence of authentication failure.



11
12
13
14
15
16
# File 'lib/multi_auth_sample/http/auth/custom_auth.rb', line 11

def error_message
  # TODO: Add your error message here in case of failure in authentication
  #
  # Example:
  # 'CustomAuth: config.access_token is undefined.'
end

#validBoolean

Validate arguments for authentication.

Returns:

  • (Boolean)

    true if the auth parameters are present.



32
33
34
35
36
37
38
# File 'lib/multi_auth_sample/http/auth/custom_auth.rb', line 32

def valid
  # TODO: Add your validation checks here
  #
  # Example:
  # return false unless @_config.access_token.nil?
  true
end