|
16 | 16 |
|
17 | 17 | import extend = require('extend');
|
18 | 18 | import vcapServices = require('vcap_services');
|
19 |
| -import { IcpTokenManagerV1 } from '../auth/icp-token-manager'; |
| 19 | +import { Icp4dTokenManagerV1 } from '../auth/icp-token-manager'; |
20 | 20 | import { IamTokenManagerV1 } from '../iam-token-manager/v1';
|
21 | 21 | import { stripTrailingSlash } from './helper';
|
22 | 22 | import { readCredentialsFile } from './read-credentials-file';
|
@@ -178,34 +178,38 @@ export class BaseService {
|
178 | 178 | _options.authentication_type = _options.authentication_type.toLowerCase();
|
179 | 179 | }
|
180 | 180 |
|
| 181 | + // rejectUnauthorized should only be false if disable_ssl_verification is true |
| 182 | + // used to disable ssl checking for icp |
| 183 | + this._options.rejectUnauthorized = !options.disable_ssl_verification; |
| 184 | + |
181 | 185 | if (_options.authentication_type === 'iam' || hasIamCredentials(_options)) {
|
182 | 186 | this.tokenManager = new IamTokenManagerV1({
|
183 | 187 | iamApikey: _options.iam_apikey || _options.password,
|
184 | 188 | accessToken: _options.iam_access_token,
|
185 | 189 | url: _options.iam_url,
|
186 | 190 | iamClientId: _options.iam_client_id,
|
187 |
| - iamClientSecret: _options.iam_client_secret |
| 191 | + iamClientSecret: _options.iam_client_secret, |
| 192 | + disableSslVerification: options.disable_ssl_verification, |
188 | 193 | });
|
189 | 194 | } else if (usesBasicForIam(_options)) {
|
190 | 195 | this.tokenManager = new IamTokenManagerV1({
|
191 | 196 | iamApikey: _options.password,
|
192 | 197 | url: _options.iam_url,
|
193 | 198 | iamClientId: _options.iam_client_id,
|
194 |
| - iamClientSecret: _options.iam_client_secret |
| 199 | + iamClientSecret: _options.iam_client_secret, |
| 200 | + disableSslVerification: options.disable_ssl_verification, |
195 | 201 | });
|
196 | 202 | } else if (isForICP4D(_options)) {
|
197 |
| - this.tokenManager = new IcpTokenManagerV1({ |
| 203 | + this.tokenManager = new Icp4dTokenManagerV1({ |
198 | 204 | url: _options.url,
|
199 | 205 | username: _options.username,
|
200 | 206 | password: _options.password,
|
201 |
| - accessToken: _options.icp_access_token |
| 207 | + accessToken: _options.icp_access_token, |
| 208 | + disableSslVerification: options.disable_ssl_verification, |
202 | 209 | });
|
203 | 210 | } else {
|
204 | 211 | this.tokenManager = null;
|
205 | 212 | }
|
206 |
| - // rejectUnauthorized should only be false if disable_ssl_verification is true |
207 |
| - // used to disable ssl checking for icp |
208 |
| - this._options.rejectUnauthorized = !options.disable_ssl_verification; |
209 | 213 | }
|
210 | 214 |
|
211 | 215 | /**
|
@@ -260,13 +264,15 @@ export class BaseService {
|
260 | 264 | if (this.tokenManager) {
|
261 | 265 | this.tokenManager.setAccessToken(access_token);
|
262 | 266 | } else if (this._options.authentication_type === 'icp4d') {
|
263 |
| - this.tokenManager = new IcpTokenManagerV1({ |
| 267 | + this.tokenManager = new Icp4dTokenManagerV1({ |
264 | 268 | accessToken: access_token,
|
265 |
| - url: this._options.url |
| 269 | + url: this._options.url, |
| 270 | + disableSslVerification: this._options.disable_ssl_verification, |
266 | 271 | });
|
267 | 272 | } else {
|
268 | 273 | this.tokenManager = new IamTokenManagerV1({
|
269 |
| - accessToken: access_token |
| 274 | + accessToken: access_token, |
| 275 | + disableSslVerification: this._options.disable_ssl_verification, |
270 | 276 | });
|
271 | 277 | }
|
272 | 278 | }
|
|
0 commit comments