ibm-cloud-sdk-core 2.15.0 → 2.15.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [2.15.1](https://github.com/IBM/node-sdk-core/compare/v2.15.0...v2.15.1) (2021-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* use correct authenticator type constants ([#170](https://github.com/IBM/node-sdk-core/issues/170)) ([ae19adc](https://github.com/IBM/node-sdk-core/commit/ae19adcc25a3257a7c336390f83033960844615e))
|
|
7
|
+
|
|
1
8
|
# [2.15.0](https://github.com/IBM/node-sdk-core/compare/v2.14.4...v2.15.0) (2021-10-15)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -48,11 +48,11 @@ var Authenticator = /** @class */ (function () {
|
|
|
48
48
|
* Constants that define the various authenticator types.
|
|
49
49
|
*/
|
|
50
50
|
Authenticator.AUTHTYPE_BASIC = 'basic';
|
|
51
|
-
Authenticator.AUTHTYPE_BEARERTOKEN = '
|
|
51
|
+
Authenticator.AUTHTYPE_BEARERTOKEN = 'bearerToken';
|
|
52
52
|
Authenticator.AUTHTYPE_IAM = 'iam';
|
|
53
53
|
Authenticator.AUTHTYPE_CONTAINER = 'container';
|
|
54
54
|
Authenticator.AUTHTYPE_CP4D = 'cp4d';
|
|
55
|
-
Authenticator.AUTHTYPE_NOAUTH = '
|
|
55
|
+
Authenticator.AUTHTYPE_NOAUTH = 'noAuth';
|
|
56
56
|
Authenticator.AUTHTYPE_UNKNOWN = 'unknown';
|
|
57
57
|
return Authenticator;
|
|
58
58
|
}());
|
|
@@ -58,32 +58,33 @@ function getAuthenticatorFromEnvironment(serviceName) {
|
|
|
58
58
|
authType = credentials.authtype;
|
|
59
59
|
}
|
|
60
60
|
if (!authType || typeof authType !== 'string') {
|
|
61
|
-
authType = credentials.apikey ?
|
|
61
|
+
authType = credentials.apikey ? authenticators_1.Authenticator.AUTHTYPE_IAM : authenticators_1.Authenticator.AUTHTYPE_CONTAINER;
|
|
62
62
|
}
|
|
63
|
-
//
|
|
63
|
+
// Create and return the appropriate authenticator.
|
|
64
64
|
var authenticator;
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
// Compare the authType against our constants case-insensitively to
|
|
66
|
+
// determine which authenticator type needs to be constructed.
|
|
67
|
+
authType = authType.toLowerCase();
|
|
68
|
+
if (authType === authenticators_1.Authenticator.AUTHTYPE_NOAUTH.toLowerCase()) {
|
|
69
|
+
authenticator = new authenticators_1.NoAuthAuthenticator();
|
|
70
|
+
}
|
|
71
|
+
else if (authType === authenticators_1.Authenticator.AUTHTYPE_BASIC.toLowerCase()) {
|
|
72
|
+
authenticator = new authenticators_1.BasicAuthenticator(credentials);
|
|
73
|
+
}
|
|
74
|
+
else if (authType === authenticators_1.Authenticator.AUTHTYPE_BEARERTOKEN.toLowerCase()) {
|
|
75
|
+
authenticator = new authenticators_1.BearerTokenAuthenticator(credentials);
|
|
76
|
+
}
|
|
77
|
+
else if (authType === authenticators_1.Authenticator.AUTHTYPE_CP4D.toLowerCase()) {
|
|
78
|
+
authenticator = new authenticators_1.CloudPakForDataAuthenticator(credentials);
|
|
79
|
+
}
|
|
80
|
+
else if (authType === authenticators_1.Authenticator.AUTHTYPE_IAM.toLowerCase()) {
|
|
81
|
+
authenticator = new authenticators_1.IamAuthenticator(credentials);
|
|
82
|
+
}
|
|
83
|
+
else if (authType === authenticators_1.Authenticator.AUTHTYPE_CONTAINER.toLowerCase()) {
|
|
84
|
+
authenticator = new authenticators_1.ContainerAuthenticator(credentials);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw new Error("Invalid value for AUTH_TYPE: " + authType);
|
|
87
88
|
}
|
|
88
89
|
return authenticator;
|
|
89
90
|
}
|