Class: IBMCloudSdkCore::IAMTokenManager

Inherits:
JWTTokenManager show all
Defined in:
lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb

Overview

Class to manage IAM Token Authentication

Constant Summary collapse

DEFAULT_IAM_URL =
"https://iam.cloud.ibm.com/identity/token"
CONTENT_TYPE =
"application/x-www-form-urlencoded"
ACCEPT =
"application/json"
REQUEST_TOKEN_GRANT_TYPE =
"urn:ibm:params:oauth:grant-type:apikey"
REQUEST_TOKEN_RESPONSE_TYPE =
"cloud_iam"
TOKEN_NAME =
"access_token"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from JWTTokenManager

#token

Constructor Details

#initialize(apikey: nil, url: nil, client_id: nil, client_secret: nil, disable_ssl_verification: nil) ⇒ IAMTokenManager

Returns a new instance of IAMTokenManager.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb', line 20

def initialize(
  apikey: nil,
  url: nil,
  client_id: nil,
  client_secret: nil,
  disable_ssl_verification: nil
)
  @apikey = apikey
  url = DEFAULT_IAM_URL if url.nil?
  @client_id = client_id
  @client_secret = client_secret
  @disable_ssl_verification = disable_ssl_verification
  super(url: url, token_name: TOKEN_NAME)
  token
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



19
20
21
# File 'lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb', line 19

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



19
20
21
# File 'lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb', line 19

def client_secret
  @client_secret
end

#token_infoObject

Returns the value of attribute token_info.



19
20
21
# File 'lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb', line 19

def token_info
  @token_info
end

#token_nameObject

Returns the value of attribute token_name.



19
20
21
# File 'lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb', line 19

def token_name
  @token_name
end

Instance Method Details

#access_tokenObject



36
37
38
# File 'lib/ibm_cloud_sdk_core/token_managers/iam_token_manager.rb', line 36

def access_token
  @token_info[TOKEN_NAME]
end