cidaas-javascript-sdk 4.3.3 → 5.0.0
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 +52 -5
- package/README.md +109 -93
- package/dist/authentication-service/AuthenticationService.d.ts +140 -0
- package/dist/authentication-service/AuthenticationService.js +210 -0
- package/dist/{authentication/Authentication.model.d.ts → authentication-service/AuthenticationService.model.d.ts} +18 -12
- package/dist/{authentication/Authentication.model.js → authentication-service/AuthenticationService.model.js} +2 -2
- package/dist/common/Common.model.d.ts +15 -19
- package/dist/common/Common.model.js +17 -17
- package/dist/common/ConfigUserProvider.d.ts +10 -0
- package/dist/common/ConfigUserProvider.js +28 -0
- package/dist/common/Helper.d.ts +7 -0
- package/dist/common/Helper.js +19 -0
- package/dist/common/User.model.d.ts +0 -4
- package/dist/consent-service/ConsentService.d.ts +99 -95
- package/dist/consent-service/ConsentService.js +125 -122
- package/dist/consent-service/ConsentService.model.d.ts +14 -16
- package/dist/device-service/DeviceService.d.ts +49 -0
- package/dist/device-service/DeviceService.js +79 -0
- package/dist/device-service/DeviceService.model.d.ts +6 -0
- package/dist/id-validation-service/IdValidationService.d.ts +28 -0
- package/dist/id-validation-service/IdValidationService.js +59 -0
- package/dist/id-validation-service/IdValidationService.model.d.ts +8 -0
- package/dist/id-validation-service/IdValidationService.model.js +2 -0
- package/dist/index.d.ts +22 -3
- package/dist/index.js +35 -18
- package/dist/login-service/LoginService.d.ts +143 -141
- package/dist/login-service/LoginService.js +225 -234
- package/dist/login-service/LoginService.model.d.ts +7 -51
- package/dist/login-service/LoginService.model.js +1 -1
- package/dist/public-service/PublicService.d.ts +57 -0
- package/dist/public-service/PublicService.js +73 -0
- package/dist/public-service/PublicService.model.d.ts +20 -0
- package/dist/public-service/PublicService.model.js +2 -0
- package/dist/token-service/TokenService.d.ts +104 -138
- package/dist/token-service/TokenService.js +164 -219
- package/dist/token-service/TokenService.model.d.ts +3 -44
- package/dist/token-service/TokenService.model.js +3 -16
- package/dist/user-service/UserService.d.ts +381 -315
- package/dist/user-service/UserService.js +552 -426
- package/dist/user-service/UserService.model.d.ts +48 -14
- package/dist/user-service/UserService.model.js +4 -4
- package/dist/verification-service/VerificationService.d.ts +281 -223
- package/dist/verification-service/VerificationService.js +343 -287
- package/dist/verification-service/VerificationService.model.d.ts +4 -5
- package/package.json +6 -4
- package/dist/authentication/Authentication.d.ts +0 -139
- package/dist/authentication/Authentication.js +0 -186
- package/dist/web-auth/WebAuth.d.ts +0 -665
- package/dist/web-auth/WebAuth.js +0 -955
- package/dist/web-auth/webauth.model.d.ts +0 -66
- /package/dist/{web-auth/webauth.model.js → device-service/DeviceService.model.js} +0 -0
|
@@ -1,294 +1,350 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VerificationService = void 0;
|
|
4
4
|
const Helper_1 = require("../common/Helper");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* ```js
|
|
10
|
-
* cidaas.initiateAccountVerification({
|
|
11
|
-
* verificationMedium: 'email',
|
|
12
|
-
* requestId: 'your requestId',
|
|
13
|
-
* processingType: ProcessingType.CODE,
|
|
14
|
-
* email: 'your email'
|
|
15
|
-
* }).then(function (response) {
|
|
16
|
-
* // the response will give you account verification details.
|
|
17
|
-
* }).catch(function(ex) {
|
|
18
|
-
* // your failure code here
|
|
19
|
-
* });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
function initiateAccountVerification(options) {
|
|
23
|
-
try {
|
|
24
|
-
const url = window.webAuthSettings.authority + "/verification-srv/account/initiate";
|
|
25
|
-
const form = Helper_1.Helper.createForm(url, options);
|
|
26
|
-
document.body.appendChild(form);
|
|
27
|
-
form.submit();
|
|
5
|
+
class VerificationService {
|
|
6
|
+
constructor(configUserProvider) {
|
|
7
|
+
this.config = configUserProvider.getConfig();
|
|
8
|
+
this.userManager = configUserProvider.getUserManager();
|
|
28
9
|
}
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
/**
|
|
11
|
+
* To initiate the account verification, call **initiateAccountVerification()**. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
|
|
12
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/cgans5erj5alg-init-account-verification for more details.
|
|
13
|
+
* @example
|
|
14
|
+
* ```js
|
|
15
|
+
* cidaasVerificationService.initiateAccountVerification({
|
|
16
|
+
* verificationMedium: 'email',
|
|
17
|
+
* requestId: 'your requestId',
|
|
18
|
+
* processingType: ProcessingType.Code,
|
|
19
|
+
* email: 'your email'
|
|
20
|
+
* }).then(function (response) {
|
|
21
|
+
* // the response will give you account verification details.
|
|
22
|
+
* }).catch(function(ex) {
|
|
23
|
+
* // your failure code here
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
initiateAccountVerification(options) {
|
|
28
|
+
try {
|
|
29
|
+
const url = this.config.authority + "/verification-srv/account/initiate";
|
|
30
|
+
const form = Helper_1.Helper.createForm(url, options);
|
|
31
|
+
document.body.appendChild(form);
|
|
32
|
+
form.submit();
|
|
33
|
+
}
|
|
34
|
+
catch (ex) {
|
|
35
|
+
throw new Helper_1.CustomException(String(ex), 417);
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
38
|
+
/**
|
|
39
|
+
* To complete the verification, call **verifyAccount()**.
|
|
40
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/r8h9mvavvw2e6-verify-account for more details.
|
|
41
|
+
* @example
|
|
42
|
+
* ```js
|
|
43
|
+
* cidaasVerificationService.verifyAccount({
|
|
44
|
+
* accvid: 'your accvid', // which you will get on initiate account verification response
|
|
45
|
+
* code: 'your code in email or sms or ivr'
|
|
46
|
+
* }).then(function (response) {
|
|
47
|
+
* // the response will give you account verification ID and unique code.
|
|
48
|
+
* }).catch(function(ex) {
|
|
49
|
+
* // your failure code here
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
verifyAccount(options, headers) {
|
|
54
|
+
const _serviceURL = this.config.authority + "/verification-srv/account/verify";
|
|
55
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* To get all configured multi factor authentication, call **getMFAList()**.
|
|
59
|
+
*
|
|
60
|
+
* As Parameter, you need to pass request id & one of the following: email or mobile phone or username.
|
|
61
|
+
*
|
|
62
|
+
* In case you are in prelogin page and don't have user information yet (such as mfa-required & account-verification page), you could pass
|
|
63
|
+
* request id & masked sub (one of the following: sub or q), depends on which one is available in the query parameter generated by cidaas.
|
|
64
|
+
*
|
|
65
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/ee688a9c52b63-list-of-configured-verification-methods for more details.
|
|
66
|
+
* @example
|
|
67
|
+
* ```js
|
|
68
|
+
* cidaasVerificationService.getMFAList({
|
|
69
|
+
* request_id: 'your request id',
|
|
70
|
+
* email: 'your email'
|
|
71
|
+
* }).then(function (response) {
|
|
72
|
+
* // the response will give you list of configured multi factor authentication
|
|
73
|
+
* }).catch(function(ex) {
|
|
74
|
+
* // your failure code here
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
getMFAList(options, headers) {
|
|
79
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/setup/public/configured/list";
|
|
80
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* to cancel mfa process, call **cancelMFA()**.
|
|
84
|
+
* @example
|
|
85
|
+
* ```js
|
|
86
|
+
* cidaasVerificationService.cancelMFA({
|
|
87
|
+
* exchange_id: 'exchange id from initiateMFA() response',
|
|
88
|
+
* reason: 'reason of mfa cancelation',
|
|
89
|
+
* type: 'authentication type e.g. email'
|
|
90
|
+
* }).then(function (response) {
|
|
91
|
+
* // your success code here
|
|
92
|
+
* }).catch(function(ex) {
|
|
93
|
+
* // your failure code here
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
cancelMFA(options, headers) {
|
|
98
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/authenticate/cancel/" + options.type;
|
|
99
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* To get list of all verification type configured, call **getAllVerificationList()**. access_token must be passed as function parameter.
|
|
103
|
+
* @example
|
|
104
|
+
* ```js
|
|
105
|
+
* cidaasVerificationService.getAllVerificationList()
|
|
106
|
+
* .then(function (response) {
|
|
107
|
+
* // type your code here
|
|
108
|
+
* })
|
|
109
|
+
* .catch(function (ex) {
|
|
110
|
+
* // your failure code here
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
getAllVerificationList(access_token, headers) {
|
|
115
|
+
const _serviceURL = `${this.config.authority}/verification-srv/config/list`;
|
|
116
|
+
if (access_token) {
|
|
117
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", access_token, headers);
|
|
118
|
+
}
|
|
119
|
+
return Helper_1.Helper.getAccessTokenFromUserStorage(this.userManager).then((accessToken) => {
|
|
120
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "GET", accessToken, headers);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* To initiate enrollment of new multi factor authentication, call **initiateEnrollment()**.
|
|
125
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/f85aef6754714-initiate-physical-verification-setup for more details.
|
|
126
|
+
* @example
|
|
127
|
+
* ```js
|
|
128
|
+
* const options = {
|
|
129
|
+
* verification_type: 'one of verification_type such as fido2, face, ivr',
|
|
130
|
+
* deviceInfo: {
|
|
131
|
+
* deviceId: '',
|
|
132
|
+
* location: {lat: '', lon: ''}
|
|
133
|
+
* }
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* cidaasVerificationService.initiateEnrollment(options)
|
|
137
|
+
* .then(function (response) {
|
|
138
|
+
* // type your code here
|
|
139
|
+
* })
|
|
140
|
+
* .catch(function (ex) {
|
|
141
|
+
* // your failure code here
|
|
142
|
+
* });
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
initiateEnrollment(options, access_token) {
|
|
146
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/setup/initiate/" + options.verification_type;
|
|
147
|
+
if (access_token) {
|
|
148
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", access_token);
|
|
149
|
+
}
|
|
150
|
+
return Helper_1.Helper.getAccessTokenFromUserStorage(this.userManager).then((accessToken) => {
|
|
151
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", accessToken);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* to get the status of MFA enrollment, call **getEnrollmentStatus()**.
|
|
156
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/b06447d02d8e0-get-status-of-physical-verification-setup-configuration for more details.
|
|
157
|
+
* @example
|
|
158
|
+
* ```js
|
|
159
|
+
* cidaasVerificationService.getEnrollmentStatus('statusId from initiateEnrollment()')
|
|
160
|
+
* .then(function (response) {
|
|
161
|
+
* // type your code here
|
|
162
|
+
* })
|
|
163
|
+
* .catch(function (ex) {
|
|
164
|
+
* // your failure code here
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
getEnrollmentStatus(status_id, access_token, headers) {
|
|
169
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/notification/status/" + status_id;
|
|
170
|
+
if (access_token) {
|
|
171
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", access_token, headers);
|
|
172
|
+
}
|
|
173
|
+
return Helper_1.Helper.getAccessTokenFromUserStorage(this.userManager).then((accessToken) => {
|
|
174
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, undefined, "POST", accessToken, headers);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* to finish enrollment process of new multi factor authentication, call **enrollVerification()**.
|
|
179
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/branches/master/20ec76e937b27-enroll-physical-verification-setup for more details.
|
|
180
|
+
* @example
|
|
181
|
+
* ```js
|
|
182
|
+
* const fidoPayload = {
|
|
183
|
+
* sub: 'your sub',
|
|
184
|
+
* exchange_id: 'exchange_id from initiateEnrollment()',
|
|
185
|
+
* verification_type: 'fido2',
|
|
186
|
+
* fido2_client_response: {
|
|
187
|
+
* client_response: 'client_response from doing fido process',
|
|
188
|
+
* fidoRequestId: 'fidoRequestId from initiateEnrollment',
|
|
189
|
+
* }
|
|
190
|
+
* }
|
|
191
|
+
* cidaasVerificationService.enrollVerification(fidoPayload)
|
|
192
|
+
* .then(function (response) {
|
|
193
|
+
* // type your code here
|
|
194
|
+
* })
|
|
195
|
+
* .catch(function (ex) {
|
|
196
|
+
* // your failure code here
|
|
197
|
+
* });
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
enrollVerification(options) {
|
|
201
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/setup/enroll/" + options.verification_type;
|
|
202
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* to see details of configured verification type, call **checkVerificationTypeConfigured()**.
|
|
206
|
+
* @example
|
|
207
|
+
* ```js
|
|
208
|
+
* cidaasVerificationService.checkVerificationTypeConfigured({
|
|
209
|
+
* request_id: 'your request id',
|
|
210
|
+
* email: 'your email',
|
|
211
|
+
* verification_type: 'email'
|
|
212
|
+
* }).then(function (response) {
|
|
213
|
+
* // type your code here
|
|
214
|
+
* })
|
|
215
|
+
* .catch(function (ex) {
|
|
216
|
+
* // your failure code here
|
|
217
|
+
* });
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
checkVerificationTypeConfigured(options) {
|
|
221
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/setup/public/configured/check/" + options.verification_type;
|
|
222
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* to initiate multi factor auhentication, call **initiateMFA()**.
|
|
226
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a3ea581bb249-initiate-verification for more details.
|
|
227
|
+
* @example
|
|
228
|
+
* ```js
|
|
229
|
+
* const options = {
|
|
230
|
+
* request_id: 'your request id',
|
|
231
|
+
* usage_type: 'PASSWORDLESS_AUTHENTICATION',
|
|
232
|
+
* type: 'email'
|
|
233
|
+
* email: 'your email'
|
|
234
|
+
* }
|
|
235
|
+
* }
|
|
236
|
+
*
|
|
237
|
+
* cidaasVerificationService.initiateMFA(options)
|
|
238
|
+
* .then(function (response) {
|
|
239
|
+
* // type your code here
|
|
240
|
+
* })
|
|
241
|
+
* .catch(function (ex) {
|
|
242
|
+
* // your failure code here
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
initiateMFA(options, headers) {
|
|
247
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/authenticate/initiate/" + options.type;
|
|
248
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* to authenticate with multi factor auhentication, call **authenticateMFA()**.
|
|
252
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
|
|
253
|
+
* @example
|
|
254
|
+
* ```js
|
|
255
|
+
* cidaasVerificationService.authenticateMFA({
|
|
256
|
+
* type: 'email',
|
|
257
|
+
* client_id: 'your client id',
|
|
258
|
+
* exchange_id: exchange id from initiateMFA(),
|
|
259
|
+
* pass_code: 'code to authenticate'
|
|
260
|
+
* }).then(function (response) {
|
|
261
|
+
* // type your code here
|
|
262
|
+
* })
|
|
263
|
+
* .catch(function (ex) {
|
|
264
|
+
* // your failure code here
|
|
265
|
+
* });
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
authenticateMFA(options, headers) {
|
|
269
|
+
const _serviceURL = this.config.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
|
|
270
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* to initiate verification process, call **initiateVerification**
|
|
274
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/odmtzu2e53f5k-initiate-verification-enrollment for more details.
|
|
275
|
+
* @example
|
|
276
|
+
* ```js
|
|
277
|
+
* const options = {
|
|
278
|
+
* mobile_number: 'your mobile number',
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* const trackId = 'your track id'
|
|
282
|
+
* const method = 'email'
|
|
283
|
+
*
|
|
284
|
+
* cidaasVerificationService.initiateVerification(options, trackId, method)
|
|
285
|
+
* .then(function (response) {
|
|
286
|
+
* // type your code here
|
|
287
|
+
* })
|
|
288
|
+
* .catch(function (ex) {
|
|
289
|
+
* // your failure code here
|
|
290
|
+
* });
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
initiateVerification(options, trackId, method) {
|
|
294
|
+
const serviceURL = this.config.authority + '/verification-actions-srv/setup/' + method + '/initiate/' + trackId;
|
|
295
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* to finish configuring verification process, call **configureVerification**
|
|
299
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/vurqjgv46yyid-initiate-verification-setup-authenticate for more details.
|
|
300
|
+
* @example
|
|
301
|
+
* ```js
|
|
302
|
+
* const options = {
|
|
303
|
+
* exchange_id: 'your exchange id';
|
|
304
|
+
* sub: 'your sub;
|
|
305
|
+
* pass_code: 'your pass code';
|
|
306
|
+
* }
|
|
307
|
+
* }
|
|
308
|
+
* const method = 'email'
|
|
309
|
+
*
|
|
310
|
+
* cidaasVerificationService.initiateVerification(options, method)
|
|
311
|
+
* .then(function (response) {
|
|
312
|
+
* // type your code here
|
|
313
|
+
* })
|
|
314
|
+
* .catch(function (ex) {
|
|
315
|
+
* // your failure code here
|
|
316
|
+
* });
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
configureVerification(options, method) {
|
|
320
|
+
const serviceURL = this.config.authority + '/verification-actions-srv/setup/' + method + '/verification';
|
|
321
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* to configure friendly name, call **configureFriendlyName**
|
|
325
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/f0i458vm5zo6z-add-a-friendly-name for more details.
|
|
326
|
+
* @example
|
|
327
|
+
* ```js
|
|
328
|
+
* const options = {
|
|
329
|
+
* sub: 'your sub;
|
|
330
|
+
* friendly_name: 'your friendly name';
|
|
331
|
+
* }
|
|
332
|
+
* }
|
|
333
|
+
* const trackId = 'your track id'
|
|
334
|
+
* const method = 'email'
|
|
335
|
+
*
|
|
336
|
+
* cidaasVerificationService.configureFriendlyName(options, trackId, method)
|
|
337
|
+
* .then(function (response) {
|
|
338
|
+
* // type your code here
|
|
339
|
+
* })
|
|
340
|
+
* .catch(function (ex) {
|
|
341
|
+
* // your failure code here
|
|
342
|
+
* });
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
configureFriendlyName(options, trackId, method) {
|
|
346
|
+
const serviceURL = this.config.authority + '/verification-actions-srv/setup/users/friendlyname/' + method.toUpperCase() + '/' + trackId;
|
|
347
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'PUT');
|
|
244
348
|
}
|
|
245
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", undefined, headers);
|
|
246
|
-
}
|
|
247
|
-
exports.initiateMFA = initiateMFA;
|
|
248
|
-
/**
|
|
249
|
-
* to authenticate with multi factor auhentication, call **authenticateMFA()**.
|
|
250
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/1aa38936252d6-perform-the-authentication-method for more details.
|
|
251
|
-
* @example
|
|
252
|
-
* ```js
|
|
253
|
-
* cidaas.authenticateMFA({
|
|
254
|
-
* type: 'email',
|
|
255
|
-
* client_id: 'your client id',
|
|
256
|
-
* exchange_id: exchange id from initiateMFA(),
|
|
257
|
-
* pass_code: 'code to authenticate'
|
|
258
|
-
* }).then(function (response) {
|
|
259
|
-
* // type your code here
|
|
260
|
-
* })
|
|
261
|
-
* .catch(function (ex) {
|
|
262
|
-
* // your failure code here
|
|
263
|
-
* });
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
function authenticateMFA(options, headers) {
|
|
267
|
-
const _serviceURL = window.webAuthSettings.authority + "/verification-srv/v2/authenticate/authenticate/" + options.type;
|
|
268
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST", undefined, headers);
|
|
269
|
-
}
|
|
270
|
-
exports.authenticateMFA = authenticateMFA;
|
|
271
|
-
/**
|
|
272
|
-
* to initiate verification process, call **initiateVerification**
|
|
273
|
-
*/
|
|
274
|
-
function initiateVerification(options, trackId, method) {
|
|
275
|
-
const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/initiate/' + trackId;
|
|
276
|
-
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
|
|
277
|
-
}
|
|
278
|
-
exports.initiateVerification = initiateVerification;
|
|
279
|
-
/**
|
|
280
|
-
* to finish configuring verification process, call **configureVerification**
|
|
281
|
-
*/
|
|
282
|
-
function configureVerification(options, method) {
|
|
283
|
-
const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/' + method + '/verification';
|
|
284
|
-
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST');
|
|
285
|
-
}
|
|
286
|
-
exports.configureVerification = configureVerification;
|
|
287
|
-
/**
|
|
288
|
-
* to configure friendly name, call **configureFriendlyName**
|
|
289
|
-
*/
|
|
290
|
-
function configureFriendlyName(options, trackId, method) {
|
|
291
|
-
const serviceURL = window.webAuthSettings.authority + '/verification-actions-srv/setup/users/friendlyname/' + method.toUpperCase() + '/' + trackId;
|
|
292
|
-
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'PUT');
|
|
293
349
|
}
|
|
294
|
-
exports.
|
|
350
|
+
exports.VerificationService = VerificationService;
|