ibm_cloud_sdk_core 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a9ddbe886404d076c07ea7b657f691b3f2a09ad758bd20efaa7555f425d75d1
|
4
|
+
data.tar.gz: 9f3eb249e1f4d6408c233239eabd4ed28f146fa906bfa3b08c9b94bb26e06661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a12157d888a148803b7943f1b372bf54d7e84822d9408426a0a6d401af80f672b5fde0bff5a1b6623e8cc8a1fb74d7cf80bfb52ad7db0c129dcd4409c4479ad
|
7
|
+
data.tar.gz: ea21d829cdb3c02dc25874649f867d5ff65d4f0cb7cdcb06542774d1aba2bbb60350ea5ea5e8bd55c6d7f6d55b449aad0c32d53f9906be9e23459265ed0ce996
|
@@ -38,7 +38,7 @@ def load_from_credential_file(service_name, separator = "=")
|
|
38
38
|
config = {}
|
39
39
|
file_contents.each_line do |line|
|
40
40
|
key_val = line.strip.split(separator)
|
41
|
-
|
41
|
+
if key_val.length == 2 && !line.start_with?("#")
|
42
42
|
key = parse_key(key_val[0].downcase, service_name) unless key_val[0].nil?
|
43
43
|
config.store(key.to_sym, key_val[1]) unless key.nil?
|
44
44
|
end
|
@@ -82,6 +82,47 @@ class BaseServiceTest < Minitest::Test
|
|
82
82
|
ENV.delete("IBM_CREDENTIALS_FILE")
|
83
83
|
end
|
84
84
|
|
85
|
+
def test_set_credentials_from_path_invalid_auth_type_value
|
86
|
+
token_layout = {
|
87
|
+
"username": "dummy",
|
88
|
+
"role": "Admin",
|
89
|
+
"permissions": %w[administrator manage_catalog],
|
90
|
+
"sub": "admin",
|
91
|
+
"iss": "sss",
|
92
|
+
"aud": "sss",
|
93
|
+
"uid": "sss",
|
94
|
+
"iat": Time.now.to_i + 3600,
|
95
|
+
"exp": Time.now.to_i
|
96
|
+
}
|
97
|
+
token = JWT.encode token_layout, "secret", "HS256"
|
98
|
+
response = {
|
99
|
+
"access_token" => token,
|
100
|
+
"token_type" => "Bearer",
|
101
|
+
"expires_in" => 3600,
|
102
|
+
"expiration" => 1_524_167_011,
|
103
|
+
"refresh_token" => "jy4gl91BQ"
|
104
|
+
}
|
105
|
+
stub_request(:post, "https://iam.cloud.ibm.com/identity/token")
|
106
|
+
.with(
|
107
|
+
body: {
|
108
|
+
"apikey" => "sadio",
|
109
|
+
"grant_type" => "urn:ibm:params:oauth:grant-type:apikey",
|
110
|
+
"response_type" => "cloud_iam"
|
111
|
+
},
|
112
|
+
headers: {
|
113
|
+
"Connection" => "close",
|
114
|
+
"Host" => "iam.cloud.ibm.com",
|
115
|
+
"User-Agent" => "http.rb/4.1.1"
|
116
|
+
}
|
117
|
+
)
|
118
|
+
.to_return(status: 200, body: response.to_json, headers: {})
|
119
|
+
file_path = File.join(File.dirname(__FILE__), "../../resources/ibm-credentials.env")
|
120
|
+
ENV["IBM_CREDENTIALS_FILE"] = file_path
|
121
|
+
authenticator = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "mane")
|
122
|
+
assert_equal(authenticator.authentication_type, "iam")
|
123
|
+
ENV.delete("IBM_CREDENTIALS_FILE")
|
124
|
+
end
|
125
|
+
|
85
126
|
def test_set_credentials_from_path_in_env_bearer_token
|
86
127
|
file_path = File.join(File.dirname(__FILE__), "../../resources/ibm-credentials.env")
|
87
128
|
ENV["IBM_CREDENTIALS_FILE"] = file_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm_cloud_sdk_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mamoon Raja
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|