cidaas-javascript-sdk 4.2.4 → 4.3.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 +41 -2
- package/README.md +9 -6
- package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
- package/dist/authentication/{index.js → Authentication.js} +2 -9
- package/dist/common/Common.model.d.ts +41 -0
- package/dist/common/Common.model.js +26 -0
- package/dist/{web-auth → common}/Helper.d.ts +6 -6
- package/dist/{web-auth → common}/Helper.js +10 -10
- package/dist/common/JwtHelper.d.ts +8 -0
- package/dist/{web-auth → common}/JwtHelper.js +8 -8
- package/dist/common/User.model.d.ts +134 -0
- package/dist/common/User.model.js +2 -0
- package/dist/consent-service/ConsentService.d.ts +97 -0
- package/dist/consent-service/ConsentService.js +127 -0
- package/dist/consent-service/ConsentService.model.d.ts +102 -0
- package/dist/consent-service/ConsentService.model.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/login-service/LoginService.d.ts +143 -0
- package/dist/login-service/LoginService.js +247 -0
- package/dist/login-service/LoginService.model.d.ts +142 -0
- package/dist/login-service/LoginService.model.js +13 -0
- package/dist/token-service/TokenService.d.ts +139 -0
- package/dist/token-service/TokenService.js +242 -0
- package/dist/token-service/TokenService.model.d.ts +149 -0
- package/dist/token-service/TokenService.model.js +43 -0
- package/dist/user-service/UserService.d.ts +317 -0
- package/dist/user-service/UserService.js +451 -0
- package/dist/user-service/UserService.model.d.ts +142 -0
- package/dist/user-service/UserService.model.js +10 -0
- package/dist/verification-service/VerificationService.d.ts +219 -0
- package/dist/verification-service/VerificationService.js +288 -0
- package/dist/verification-service/VerificationService.model.d.ts +158 -0
- package/dist/verification-service/VerificationService.model.js +2 -0
- package/dist/web-auth/WebAuth.d.ts +138 -178
- package/dist/web-auth/WebAuth.js +183 -177
- package/dist/web-auth/webauth.model.d.ts +66 -0
- package/dist/web-auth/webauth.model.js +2 -0
- package/package.json +2 -2
- package/dist/web-auth/ConsentService.d.ts +0 -123
- package/dist/web-auth/ConsentService.js +0 -136
- package/dist/web-auth/Entities.d.ts +0 -516
- package/dist/web-auth/Entities.js +0 -69
- package/dist/web-auth/JwtHelper.d.ts +0 -7
- package/dist/web-auth/LoginService.d.ts +0 -165
- package/dist/web-auth/LoginService.js +0 -246
- package/dist/web-auth/TokenService.d.ts +0 -143
- package/dist/web-auth/TokenService.js +0 -249
- package/dist/web-auth/UserService.d.ts +0 -345
- package/dist/web-auth/UserService.js +0 -471
- package/dist/web-auth/VerificationService.d.ts +0 -224
- package/dist/web-auth/VerificationService.js +0 -278
- /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
- /package/dist/authentication/{authentication.model.js → Authentication.model.js} +0 -0
package/dist/web-auth/WebAuth.js
CHANGED
|
@@ -10,13 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.WebAuth = exports.createPreloginWebauth = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
13
|
+
const Helper_1 = require("../common/Helper");
|
|
14
|
+
const LoginService = require("../login-service/LoginService");
|
|
15
|
+
const UserService = require("../user-service/UserService");
|
|
16
|
+
const TokenService = require("../token-service/TokenService");
|
|
17
|
+
const VerificationService = require("../verification-service/VerificationService");
|
|
18
|
+
const ConsentService = require("../consent-service/ConsentService");
|
|
19
|
+
const Authentication_1 = require("../authentication/Authentication");
|
|
20
|
+
const Authentication_model_1 = require("../authentication/Authentication.model");
|
|
20
21
|
const createPreloginWebauth = (authority) => {
|
|
21
22
|
return new WebAuth({ 'authority': authority });
|
|
22
23
|
};
|
|
@@ -33,11 +34,11 @@ class WebAuth {
|
|
|
33
34
|
if (settings.authority && settings.authority.charAt(settings.authority.length - 1) === '/') {
|
|
34
35
|
settings.authority = settings.authority.slice(0, settings.authority.length - 1);
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
const usermanager = new Authentication_model_1.OidcManager(settings);
|
|
37
38
|
window.webAuthSettings = settings;
|
|
38
39
|
window.usermanager = usermanager;
|
|
39
40
|
window.localeSettings = null;
|
|
40
|
-
window.authentication = new
|
|
41
|
+
window.authentication = new Authentication_1.Authentication(window.webAuthSettings, window.usermanager);
|
|
41
42
|
window.usermanager.events.addSilentRenewError(function () {
|
|
42
43
|
throw new Helper_1.CustomException("Error while renewing silent login", 500);
|
|
43
44
|
});
|
|
@@ -57,7 +58,6 @@ class WebAuth {
|
|
|
57
58
|
}
|
|
58
59
|
return window.authentication.loginOrRegisterWithBrowser('login', options);
|
|
59
60
|
}
|
|
60
|
-
;
|
|
61
61
|
/**
|
|
62
62
|
* Generate and open authz url in a popup window.
|
|
63
63
|
* On successful sign in, authenticated user is returned.
|
|
@@ -72,7 +72,6 @@ class WebAuth {
|
|
|
72
72
|
}
|
|
73
73
|
return window.authentication.popupSignIn(options);
|
|
74
74
|
}
|
|
75
|
-
;
|
|
76
75
|
/**
|
|
77
76
|
* Generate and navigate to authz url in an iFrame.
|
|
78
77
|
* On successful sign in, authenticated user is returned
|
|
@@ -87,7 +86,6 @@ class WebAuth {
|
|
|
87
86
|
}
|
|
88
87
|
return window.authentication.silentSignIn(options);
|
|
89
88
|
}
|
|
90
|
-
;
|
|
91
89
|
/**
|
|
92
90
|
* Generate and redirect to authz url in same window for register view.
|
|
93
91
|
* @param {LoginRedirectOptions} options options options to over-ride the client config for redirect login
|
|
@@ -98,7 +96,6 @@ class WebAuth {
|
|
|
98
96
|
}
|
|
99
97
|
return window.authentication.loginOrRegisterWithBrowser('register', options);
|
|
100
98
|
}
|
|
101
|
-
;
|
|
102
99
|
/**
|
|
103
100
|
* Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
|
|
104
101
|
* To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
@@ -113,7 +110,6 @@ class WebAuth {
|
|
|
113
110
|
}
|
|
114
111
|
return window.authentication.loginCallback(url);
|
|
115
112
|
}
|
|
116
|
-
;
|
|
117
113
|
/**
|
|
118
114
|
* To complete the popup login process, call **popupSignInCallback()** from the popup login window.
|
|
119
115
|
* Popup window will be closed after doing callback
|
|
@@ -127,7 +123,6 @@ class WebAuth {
|
|
|
127
123
|
}
|
|
128
124
|
return window.authentication.popupSignInCallback(url, keepOpen);
|
|
129
125
|
}
|
|
130
|
-
;
|
|
131
126
|
/**
|
|
132
127
|
* Returns a promise to notify the parent window of response from authz service
|
|
133
128
|
* @param {string} url optional url to check authz response, if none window.location is used
|
|
@@ -138,7 +133,6 @@ class WebAuth {
|
|
|
138
133
|
}
|
|
139
134
|
return window.authentication.silentSignInCallback(url);
|
|
140
135
|
}
|
|
141
|
-
;
|
|
142
136
|
/**
|
|
143
137
|
* To get the user profile information by using oidc-client-ts library, call **getUserInfo()**. This will return the basic user profile details along with groups, roles and whatever scopes you mentioned in the options.
|
|
144
138
|
* @example
|
|
@@ -159,7 +153,6 @@ class WebAuth {
|
|
|
159
153
|
return yield window.usermanager.getUser();
|
|
160
154
|
});
|
|
161
155
|
}
|
|
162
|
-
;
|
|
163
156
|
/**
|
|
164
157
|
* logout by using oidc-client-ts library
|
|
165
158
|
* @param {LogoutRedirectOptions} options optional options to over-ride logout options on redirect
|
|
@@ -170,7 +163,6 @@ class WebAuth {
|
|
|
170
163
|
}
|
|
171
164
|
return window.authentication.logout(options);
|
|
172
165
|
}
|
|
173
|
-
;
|
|
174
166
|
/**
|
|
175
167
|
* logout by using oidc-client-ts library
|
|
176
168
|
* @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
|
|
@@ -181,7 +173,6 @@ class WebAuth {
|
|
|
181
173
|
}
|
|
182
174
|
return window.authentication.popupSignOut(options);
|
|
183
175
|
}
|
|
184
|
-
;
|
|
185
176
|
/**
|
|
186
177
|
* get the logout call state from the url provided, if none is provided current window url is used
|
|
187
178
|
* @returns {Promise<LogoutResponse>} logout response from auth service
|
|
@@ -192,7 +183,6 @@ class WebAuth {
|
|
|
192
183
|
}
|
|
193
184
|
return window.authentication.logoutCallback(url);
|
|
194
185
|
}
|
|
195
|
-
;
|
|
196
186
|
/**
|
|
197
187
|
* listen to popup sign out event
|
|
198
188
|
* @param {string} url optional url to override to check for sign out state
|
|
@@ -205,7 +195,6 @@ class WebAuth {
|
|
|
205
195
|
url = url || window.webAuthSettings.post_logout_redirect_uri;
|
|
206
196
|
return window.authentication.popupSignOutCallback(url, keepOpen);
|
|
207
197
|
}
|
|
208
|
-
;
|
|
209
198
|
/**
|
|
210
199
|
* To get the generated login url, call **getLoginURL()**. This will call authz service and generate login url to be used.
|
|
211
200
|
* @example
|
|
@@ -224,36 +213,45 @@ class WebAuth {
|
|
|
224
213
|
return Promise.reject(new Helper_1.CustomException("Settings or Authentication instance in OIDC cannot be empty", 417));
|
|
225
214
|
}
|
|
226
215
|
return new Promise((resolve, reject) => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
catch (e) {
|
|
216
|
+
window.usermanager.getClient().createSigninRequest(Object.assign(Object.assign({}, window.webAuthSettings), (options && { options } || {}))).then((signinRequest) => {
|
|
217
|
+
resolve(signinRequest.url);
|
|
218
|
+
}).catch(e => {
|
|
233
219
|
reject(e);
|
|
234
|
-
}
|
|
220
|
+
});
|
|
235
221
|
});
|
|
236
222
|
}
|
|
237
|
-
;
|
|
238
223
|
/**
|
|
239
224
|
* Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call **getRequestId()**.
|
|
240
225
|
* @example
|
|
241
226
|
* ```js
|
|
242
|
-
*
|
|
227
|
+
* const option: GetRequestIdRequest = {
|
|
228
|
+
* 'client_id': 'your client id',
|
|
229
|
+
* 'redirect_uri': 'your redirect url',
|
|
230
|
+
* 'scope': 'your scopes',
|
|
231
|
+
* }
|
|
232
|
+
* cidaas.getRequestId(option).then(function (response) {
|
|
243
233
|
* // the response will give you request id.
|
|
244
234
|
* }).catch(function(ex) {
|
|
245
235
|
* // your failure code here
|
|
246
236
|
* });
|
|
247
237
|
* ```
|
|
248
238
|
*/
|
|
249
|
-
getRequestId() {
|
|
250
|
-
var _a, _b;
|
|
239
|
+
getRequestId(option) {
|
|
251
240
|
const ui_locales = window.webAuthSettings.ui_locales;
|
|
252
|
-
const
|
|
241
|
+
const defaultPayload = Object.assign({ 'client_id': window.webAuthSettings.client_id, 'redirect_uri': window.webAuthSettings.redirect_uri, 'response_type': window.webAuthSettings.response_type, 'response_mode': window.webAuthSettings.response_mode, 'scope': window.webAuthSettings.scope }, (ui_locales && { ui_locales } || {}));
|
|
242
|
+
const payload = option ? option : defaultPayload;
|
|
243
|
+
if (!payload.response_type) {
|
|
244
|
+
payload.response_type = 'token';
|
|
245
|
+
}
|
|
246
|
+
if (!payload.response_mode) {
|
|
247
|
+
payload.response_mode = 'fragment';
|
|
248
|
+
}
|
|
249
|
+
if (!payload.nonce) {
|
|
250
|
+
payload.nonce = new Date().getTime().toString();
|
|
251
|
+
}
|
|
253
252
|
const serviceURL = window.webAuthSettings.authority + '/authz-srv/authrequest/authz/generate';
|
|
254
|
-
return Helper_1.Helper.createHttpPromise(
|
|
253
|
+
return Helper_1.Helper.createHttpPromise(payload, serviceURL, false, "POST");
|
|
255
254
|
}
|
|
256
|
-
;
|
|
257
255
|
/**
|
|
258
256
|
* To get the tenant basic information, call **getTenantInfo()**. This will return the basic tenant details such as tenant name and allowed login with types (Email, Mobile, Username).
|
|
259
257
|
* @example
|
|
@@ -269,7 +267,6 @@ class WebAuth {
|
|
|
269
267
|
const _serviceURL = window.webAuthSettings.authority + "/public-srv/tenantinfo/basic";
|
|
270
268
|
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
271
269
|
}
|
|
272
|
-
;
|
|
273
270
|
/**
|
|
274
271
|
* To logout the user by using cidaas internal api, call **logoutUser()**.
|
|
275
272
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3b5ce6a54bf29-logout for more details.
|
|
@@ -283,7 +280,6 @@ class WebAuth {
|
|
|
283
280
|
logoutUser(options) {
|
|
284
281
|
window.location.href = window.webAuthSettings.authority + "/session/end_session?access_token_hint=" + options.access_token + "&post_logout_redirect_uri=" + window.webAuthSettings.post_logout_redirect_uri;
|
|
285
282
|
}
|
|
286
|
-
;
|
|
287
283
|
/**
|
|
288
284
|
* To get the client basic information, call **getClientInfo()**. This will return the basic client details such as client name and its details.
|
|
289
285
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/dc8a6cfb28abb-public-page-information for more details.
|
|
@@ -302,13 +298,12 @@ class WebAuth {
|
|
|
302
298
|
const _serviceURL = window.webAuthSettings.authority + "/public-srv/public/" + options.requestId;
|
|
303
299
|
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
304
300
|
}
|
|
305
|
-
;
|
|
306
301
|
/**
|
|
307
302
|
* To get all devices information associated to the client, call **getDevicesInfo()**
|
|
308
303
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2a2feed70303c-get-device-by-user for more details.
|
|
309
304
|
* @example
|
|
310
305
|
* ```js
|
|
311
|
-
* const options =
|
|
306
|
+
* const options = null; // the payload is deprecated and will be removed in the next major release
|
|
312
307
|
* const accessToken = 'your access token';
|
|
313
308
|
* cidaas.getDevicesInfo(options, accessToken).then(function (resp) {
|
|
314
309
|
* // the response will give you devices informations.
|
|
@@ -318,14 +313,10 @@ class WebAuth {
|
|
|
318
313
|
* ```
|
|
319
314
|
*/
|
|
320
315
|
getDevicesInfo(options, accessToken) {
|
|
321
|
-
options
|
|
316
|
+
options = undefined;
|
|
322
317
|
const _serviceURL = window.webAuthSettings.authority + "/device-srv/devices";
|
|
323
|
-
|
|
324
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "GET", accessToken);
|
|
325
|
-
}
|
|
326
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", accessToken);
|
|
318
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "GET", accessToken);
|
|
327
319
|
}
|
|
328
|
-
;
|
|
329
320
|
/**
|
|
330
321
|
* To delete device associated to the client, call **deleteDevice()**
|
|
331
322
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3d44ad903d6e8-logout-the-user-for-a-device for more details.
|
|
@@ -350,7 +341,6 @@ class WebAuth {
|
|
|
350
341
|
}
|
|
351
342
|
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "DELETE", accessToken);
|
|
352
343
|
}
|
|
353
|
-
;
|
|
354
344
|
/**
|
|
355
345
|
* To handle registration, first you need the registration fields. To get the registration fields, call **getRegistrationSetup()**. This will return the fields that has to be needed while registration.
|
|
356
346
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4eae72956f65a-registration-field-setup for more details.
|
|
@@ -370,7 +360,6 @@ class WebAuth {
|
|
|
370
360
|
const serviceURL = window.webAuthSettings.authority + '/registration-setup-srv/public/list?acceptlanguage=' + options.acceptlanguage + '&requestId=' + options.requestId;
|
|
371
361
|
return Helper_1.Helper.createHttpPromise(undefined, serviceURL, false, 'GET');
|
|
372
362
|
}
|
|
373
|
-
;
|
|
374
363
|
/**
|
|
375
364
|
* to generate device info, call **createDeviceInfo()**.
|
|
376
365
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9b5a892afaf0b-create-device-info for more details.
|
|
@@ -393,69 +382,61 @@ class WebAuth {
|
|
|
393
382
|
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST');
|
|
394
383
|
}
|
|
395
384
|
}
|
|
396
|
-
;
|
|
397
385
|
/**
|
|
398
386
|
* get the user profile information
|
|
399
387
|
* @param options
|
|
400
388
|
* @returns
|
|
401
389
|
*/
|
|
402
390
|
getUserProfile(options) {
|
|
403
|
-
return
|
|
391
|
+
return UserService.getUserProfile(options);
|
|
404
392
|
}
|
|
405
|
-
;
|
|
406
393
|
/**
|
|
407
394
|
* renew token using refresh token
|
|
408
395
|
* @param options
|
|
409
396
|
* @returns
|
|
410
397
|
*/
|
|
411
398
|
renewToken(options) {
|
|
412
|
-
return
|
|
399
|
+
return TokenService.renewToken(options);
|
|
413
400
|
}
|
|
414
|
-
;
|
|
415
401
|
/**
|
|
416
402
|
* get access token from code
|
|
417
403
|
* @param options
|
|
418
404
|
* @returns
|
|
419
405
|
*/
|
|
420
406
|
getAccessToken(options) {
|
|
421
|
-
return
|
|
407
|
+
return TokenService.getAccessToken(options);
|
|
422
408
|
}
|
|
423
|
-
;
|
|
424
409
|
/**
|
|
425
410
|
* validate access token
|
|
426
411
|
* @param options
|
|
427
412
|
* @returns
|
|
428
413
|
*/
|
|
429
414
|
validateAccessToken(options) {
|
|
430
|
-
return
|
|
415
|
+
return TokenService.validateAccessToken(options);
|
|
431
416
|
}
|
|
432
|
-
;
|
|
433
417
|
/**
|
|
434
418
|
* login with username and password
|
|
435
419
|
* @param options
|
|
436
420
|
*/
|
|
437
421
|
loginWithCredentials(options) {
|
|
438
|
-
|
|
422
|
+
LoginService.loginWithCredentials(options);
|
|
439
423
|
}
|
|
440
|
-
;
|
|
441
424
|
/**
|
|
442
425
|
* login with social
|
|
443
426
|
* @param options
|
|
444
427
|
* @param queryParams
|
|
445
428
|
*/
|
|
446
429
|
loginWithSocial(options, queryParams) {
|
|
447
|
-
|
|
430
|
+
LoginService.loginWithSocial(options, queryParams);
|
|
448
431
|
}
|
|
449
|
-
;
|
|
450
432
|
/**
|
|
451
433
|
* register with social
|
|
452
434
|
* @param options
|
|
453
435
|
* @param queryParams
|
|
454
436
|
*/
|
|
455
437
|
registerWithSocial(options, queryParams) {
|
|
456
|
-
|
|
438
|
+
LoginService.registerWithSocial(options, queryParams);
|
|
457
439
|
}
|
|
458
|
-
;
|
|
459
440
|
/**
|
|
460
441
|
* register user
|
|
461
442
|
* @param options
|
|
@@ -463,210 +444,203 @@ class WebAuth {
|
|
|
463
444
|
* @returns
|
|
464
445
|
*/
|
|
465
446
|
register(options, headers) {
|
|
466
|
-
return
|
|
447
|
+
return UserService.register(options, headers);
|
|
467
448
|
}
|
|
468
|
-
;
|
|
469
449
|
/**
|
|
470
450
|
* get invite info
|
|
471
451
|
* @param options
|
|
452
|
+
* @param headers
|
|
472
453
|
* @returns
|
|
473
454
|
*/
|
|
474
|
-
getInviteUserDetails(options) {
|
|
475
|
-
return
|
|
455
|
+
getInviteUserDetails(options, headers) {
|
|
456
|
+
return UserService.getInviteUserDetails(options, headers);
|
|
476
457
|
}
|
|
477
|
-
;
|
|
478
458
|
/**
|
|
479
459
|
* get Communication status
|
|
480
460
|
* @param options
|
|
461
|
+
* @param headers
|
|
481
462
|
* @returns
|
|
482
463
|
*/
|
|
483
464
|
getCommunicationStatus(options, headers) {
|
|
484
|
-
return
|
|
465
|
+
return UserService.getCommunicationStatus(options, headers);
|
|
485
466
|
}
|
|
486
|
-
;
|
|
487
467
|
/**
|
|
488
468
|
* initiate verification
|
|
489
469
|
* @param options
|
|
490
470
|
* @returns
|
|
491
471
|
*/
|
|
492
472
|
initiateAccountVerification(options) {
|
|
493
|
-
|
|
473
|
+
VerificationService.initiateAccountVerification(options);
|
|
494
474
|
}
|
|
495
|
-
;
|
|
496
475
|
/**
|
|
497
476
|
* verify account
|
|
498
477
|
* @param options
|
|
478
|
+
* @param headers
|
|
499
479
|
* @returns
|
|
500
480
|
*/
|
|
501
|
-
verifyAccount(options) {
|
|
502
|
-
return
|
|
481
|
+
verifyAccount(options, headers) {
|
|
482
|
+
return VerificationService.verifyAccount(options, headers);
|
|
503
483
|
}
|
|
504
|
-
;
|
|
505
484
|
/**
|
|
506
485
|
* initiate reset password
|
|
507
486
|
* @param options
|
|
487
|
+
* @param headers
|
|
508
488
|
* @returns
|
|
509
489
|
*/
|
|
510
|
-
initiateResetPassword(options) {
|
|
511
|
-
return
|
|
490
|
+
initiateResetPassword(options, headers) {
|
|
491
|
+
return UserService.initiateResetPassword(options, headers);
|
|
512
492
|
}
|
|
513
|
-
;
|
|
514
493
|
/**
|
|
515
494
|
* handle reset password
|
|
516
495
|
* @param options
|
|
496
|
+
* @param handleResponseAsJson
|
|
497
|
+
* @param headers
|
|
517
498
|
*/
|
|
518
|
-
handleResetPassword(options) {
|
|
519
|
-
return
|
|
499
|
+
handleResetPassword(options, handleResponseAsJson, headers) {
|
|
500
|
+
return UserService.handleResetPassword(options, handleResponseAsJson, headers);
|
|
520
501
|
}
|
|
521
|
-
;
|
|
522
502
|
/**
|
|
523
503
|
* reset password
|
|
524
504
|
* @param options
|
|
505
|
+
* @param handleResponseAsJson
|
|
506
|
+
* @param headers
|
|
525
507
|
*/
|
|
526
|
-
resetPassword(options) {
|
|
527
|
-
return
|
|
508
|
+
resetPassword(options, handleResponseAsJson, headers) {
|
|
509
|
+
return UserService.resetPassword(options, handleResponseAsJson, headers);
|
|
528
510
|
}
|
|
529
|
-
;
|
|
530
511
|
/**
|
|
531
512
|
* get mfa list
|
|
532
513
|
* @param options
|
|
514
|
+
* @param headers
|
|
533
515
|
* @returns
|
|
534
516
|
*/
|
|
535
|
-
getMFAList(options) {
|
|
536
|
-
return
|
|
517
|
+
getMFAList(options, headers) {
|
|
518
|
+
return VerificationService.getMFAList(options, headers);
|
|
537
519
|
}
|
|
538
|
-
;
|
|
539
520
|
/**
|
|
540
521
|
* cancel mfa
|
|
541
522
|
* @param options
|
|
523
|
+
* @param headers
|
|
542
524
|
* @returns
|
|
543
525
|
*/
|
|
544
|
-
cancelMFA(options) {
|
|
545
|
-
return
|
|
526
|
+
cancelMFA(options, headers) {
|
|
527
|
+
return VerificationService.cancelMFA(options, headers);
|
|
546
528
|
}
|
|
547
|
-
;
|
|
548
529
|
/**
|
|
549
530
|
* passwordless login
|
|
550
531
|
* @param options
|
|
551
532
|
*/
|
|
552
533
|
passwordlessLogin(options) {
|
|
553
|
-
|
|
534
|
+
LoginService.passwordlessLogin(options);
|
|
554
535
|
}
|
|
555
|
-
;
|
|
556
536
|
/**
|
|
557
537
|
* get user consent details
|
|
558
538
|
* @param options
|
|
559
539
|
* @returns
|
|
560
540
|
*/
|
|
561
|
-
getConsentDetails(options) {
|
|
562
|
-
return
|
|
541
|
+
getConsentDetails(options, headers) {
|
|
542
|
+
return ConsentService.getConsentDetails(options, headers);
|
|
563
543
|
}
|
|
564
|
-
;
|
|
565
544
|
/**
|
|
566
545
|
* accept consent
|
|
567
546
|
* @param options
|
|
547
|
+
* @param headers
|
|
568
548
|
* @returns
|
|
569
549
|
*/
|
|
570
|
-
acceptConsent(options) {
|
|
571
|
-
return
|
|
550
|
+
acceptConsent(options, headers) {
|
|
551
|
+
return ConsentService.acceptConsent(options, headers);
|
|
572
552
|
}
|
|
573
|
-
;
|
|
574
553
|
/**
|
|
575
554
|
* get scope consent details
|
|
576
555
|
* @param options
|
|
556
|
+
* @param headers
|
|
577
557
|
* @returns
|
|
578
558
|
*/
|
|
579
|
-
loginPrecheck(options) {
|
|
580
|
-
return
|
|
559
|
+
loginPrecheck(options, headers) {
|
|
560
|
+
return TokenService.loginPrecheck(options, headers);
|
|
581
561
|
}
|
|
582
|
-
;
|
|
583
562
|
/**
|
|
584
563
|
* get scope consent version details
|
|
585
564
|
* @param options
|
|
565
|
+
* @param headers
|
|
586
566
|
* @returns
|
|
587
567
|
*/
|
|
588
|
-
getConsentVersionDetails(options) {
|
|
589
|
-
return
|
|
568
|
+
getConsentVersionDetails(options, headers) {
|
|
569
|
+
return ConsentService.getConsentVersionDetails(options, headers);
|
|
590
570
|
}
|
|
591
|
-
;
|
|
592
571
|
/**
|
|
593
572
|
* accept scope Consent
|
|
594
573
|
* @param options
|
|
574
|
+
* @param headers
|
|
595
575
|
* @returns
|
|
596
576
|
*/
|
|
597
|
-
acceptScopeConsent(options) {
|
|
598
|
-
return
|
|
577
|
+
acceptScopeConsent(options, headers) {
|
|
578
|
+
return ConsentService.acceptScopeConsent(options, headers);
|
|
599
579
|
}
|
|
600
|
-
;
|
|
601
580
|
/**
|
|
602
581
|
* accept claim Consent
|
|
603
582
|
* @param options
|
|
583
|
+
* @param headers
|
|
604
584
|
* @returns
|
|
605
585
|
*/
|
|
606
|
-
acceptClaimConsent(options) {
|
|
607
|
-
return
|
|
586
|
+
acceptClaimConsent(options, headers) {
|
|
587
|
+
return ConsentService.acceptClaimConsent(options, headers);
|
|
608
588
|
}
|
|
609
|
-
;
|
|
610
589
|
/**
|
|
611
590
|
* revoke claim Consent
|
|
612
591
|
* @param options
|
|
613
592
|
* @returns
|
|
614
593
|
*/
|
|
615
594
|
revokeClaimConsent(options) {
|
|
616
|
-
return
|
|
595
|
+
return ConsentService.revokeClaimConsent(options);
|
|
617
596
|
}
|
|
618
|
-
;
|
|
619
597
|
/**
|
|
620
598
|
* get Deduplication details
|
|
621
599
|
* @param options
|
|
600
|
+
* @param headers
|
|
622
601
|
* @returns
|
|
623
602
|
*/
|
|
624
|
-
getDeduplicationDetails(options) {
|
|
625
|
-
return
|
|
603
|
+
getDeduplicationDetails(options, headers) {
|
|
604
|
+
return UserService.getDeduplicationDetails(options, headers);
|
|
626
605
|
}
|
|
627
|
-
;
|
|
628
606
|
/**
|
|
629
607
|
* deduplication login
|
|
630
608
|
* @param options
|
|
631
609
|
*/
|
|
632
610
|
deduplicationLogin(options) {
|
|
633
|
-
|
|
611
|
+
UserService.deduplicationLogin(options);
|
|
634
612
|
}
|
|
635
|
-
;
|
|
636
613
|
/**
|
|
637
614
|
* register Deduplication
|
|
638
615
|
* @param options
|
|
616
|
+
* @param headers
|
|
639
617
|
* @returns
|
|
640
618
|
*/
|
|
641
|
-
registerDeduplication(options) {
|
|
642
|
-
return
|
|
619
|
+
registerDeduplication(options, headers) {
|
|
620
|
+
return UserService.registerDeduplication(options, headers);
|
|
643
621
|
}
|
|
644
|
-
;
|
|
645
622
|
/**
|
|
646
|
-
* accepts any as the request
|
|
647
623
|
* consent continue login
|
|
648
624
|
* @param options
|
|
649
625
|
*/
|
|
650
626
|
consentContinue(options) {
|
|
651
|
-
|
|
627
|
+
LoginService.consentContinue(options);
|
|
652
628
|
}
|
|
653
|
-
;
|
|
654
629
|
/**
|
|
655
630
|
* mfa continue login
|
|
631
|
+
* options: PhysicalVerificationLoginRequest is not needed anymore. It is now DEPRECATED and will be removed in the next major release
|
|
656
632
|
* @param options
|
|
657
633
|
*/
|
|
658
634
|
mfaContinue(options) {
|
|
659
|
-
|
|
635
|
+
LoginService.mfaContinue(options);
|
|
660
636
|
}
|
|
661
|
-
;
|
|
662
637
|
/**
|
|
663
638
|
* change password continue
|
|
664
639
|
* @param options
|
|
665
640
|
*/
|
|
666
641
|
firstTimeChangePassword(options) {
|
|
667
|
-
|
|
642
|
+
LoginService.firstTimeChangePassword(options);
|
|
668
643
|
}
|
|
669
|
-
;
|
|
670
644
|
/**
|
|
671
645
|
* change password
|
|
672
646
|
* @param options
|
|
@@ -674,9 +648,8 @@ class WebAuth {
|
|
|
674
648
|
* @returns
|
|
675
649
|
*/
|
|
676
650
|
changePassword(options, access_token) {
|
|
677
|
-
return
|
|
651
|
+
return UserService.changePassword(options, access_token);
|
|
678
652
|
}
|
|
679
|
-
;
|
|
680
653
|
/**
|
|
681
654
|
* update profile
|
|
682
655
|
* @param options
|
|
@@ -685,9 +658,8 @@ class WebAuth {
|
|
|
685
658
|
* @returns
|
|
686
659
|
*/
|
|
687
660
|
updateProfile(options, access_token, sub) {
|
|
688
|
-
return
|
|
661
|
+
return UserService.updateProfile(options, access_token, sub);
|
|
689
662
|
}
|
|
690
|
-
;
|
|
691
663
|
/**
|
|
692
664
|
* To get user activities, call **getUserActivities()**.
|
|
693
665
|
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/346141453781e-get-user-activities for more details.
|
|
@@ -712,14 +684,29 @@ class WebAuth {
|
|
|
712
684
|
const serviceURL = window.webAuthSettings.authority + '/activity-streams-srv/user-activities';
|
|
713
685
|
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST', accessToken);
|
|
714
686
|
}
|
|
687
|
+
/**
|
|
688
|
+
* To run predefined action after enrollment, call userActionOnEnrollment()
|
|
689
|
+
* @param options
|
|
690
|
+
* @param trackId
|
|
691
|
+
* @example
|
|
692
|
+
* ```js
|
|
693
|
+
* const options = {
|
|
694
|
+
* action: 'predefined action'
|
|
695
|
+
* };
|
|
696
|
+
* cidaas.userActionOnEnrollment(options, 'trackId');
|
|
697
|
+
*/
|
|
698
|
+
userActionOnEnrollment(options, trackId) {
|
|
699
|
+
const serviceURL = window.webAuthSettings.authority + '/auth-actions-srv/validation/' + trackId;
|
|
700
|
+
return Helper_1.Helper.createHttpPromise(options, serviceURL, false, 'POST');
|
|
701
|
+
}
|
|
715
702
|
/**
|
|
716
703
|
* @param access_token
|
|
704
|
+
* @param headers
|
|
717
705
|
* @returns
|
|
718
706
|
*/
|
|
719
|
-
getAllVerificationList(access_token) {
|
|
720
|
-
return
|
|
707
|
+
getAllVerificationList(access_token, headers) {
|
|
708
|
+
return VerificationService.getAllVerificationList(access_token, headers);
|
|
721
709
|
}
|
|
722
|
-
;
|
|
723
710
|
/**
|
|
724
711
|
* initiate link accoount
|
|
725
712
|
* @param options
|
|
@@ -727,9 +714,8 @@ class WebAuth {
|
|
|
727
714
|
* @returns
|
|
728
715
|
*/
|
|
729
716
|
initiateLinkAccount(options, access_token) {
|
|
730
|
-
return
|
|
717
|
+
return UserService.initiateLinkAccount(options, access_token);
|
|
731
718
|
}
|
|
732
|
-
;
|
|
733
719
|
/**
|
|
734
720
|
* complete link accoount
|
|
735
721
|
* @param options
|
|
@@ -737,9 +723,8 @@ class WebAuth {
|
|
|
737
723
|
* @returns
|
|
738
724
|
*/
|
|
739
725
|
completeLinkAccount(options, access_token) {
|
|
740
|
-
return
|
|
726
|
+
return UserService.completeLinkAccount(options, access_token);
|
|
741
727
|
}
|
|
742
|
-
;
|
|
743
728
|
/**
|
|
744
729
|
* get linked users
|
|
745
730
|
* @param access_token
|
|
@@ -747,9 +732,8 @@ class WebAuth {
|
|
|
747
732
|
* @returns
|
|
748
733
|
*/
|
|
749
734
|
getLinkedUsers(access_token, sub) {
|
|
750
|
-
return
|
|
735
|
+
return UserService.getLinkedUsers(access_token, sub);
|
|
751
736
|
}
|
|
752
|
-
;
|
|
753
737
|
/**
|
|
754
738
|
* unlink accoount
|
|
755
739
|
* @param access_token
|
|
@@ -757,9 +741,8 @@ class WebAuth {
|
|
|
757
741
|
* @returns
|
|
758
742
|
*/
|
|
759
743
|
unlinkAccount(access_token, identityId) {
|
|
760
|
-
return
|
|
744
|
+
return UserService.unlinkAccount(access_token, identityId);
|
|
761
745
|
}
|
|
762
|
-
;
|
|
763
746
|
/**
|
|
764
747
|
* To change profile image, call **updateProfileImage()**.
|
|
765
748
|
* @example
|
|
@@ -796,55 +779,50 @@ class WebAuth {
|
|
|
796
779
|
formdata.set('photo', options.photo, options.filename);
|
|
797
780
|
return Helper_1.Helper.createHttpPromise(options, serviceURL, undefined, 'POST', access_token, null, formdata);
|
|
798
781
|
}
|
|
799
|
-
;
|
|
800
782
|
/**
|
|
801
783
|
* enrollVerification
|
|
802
784
|
* @param options
|
|
803
785
|
* @returns
|
|
804
786
|
*/
|
|
805
787
|
initiateEnrollment(options, accessToken) {
|
|
806
|
-
return
|
|
788
|
+
return VerificationService.initiateEnrollment(options, accessToken);
|
|
807
789
|
}
|
|
808
|
-
;
|
|
809
790
|
/**
|
|
810
791
|
* update the status of notification
|
|
811
792
|
* @param status_id
|
|
793
|
+
* @param headers
|
|
812
794
|
* @returns
|
|
813
795
|
*/
|
|
814
|
-
getEnrollmentStatus(status_id, accessToken) {
|
|
815
|
-
return
|
|
796
|
+
getEnrollmentStatus(status_id, accessToken, headers) {
|
|
797
|
+
return VerificationService.getEnrollmentStatus(status_id, accessToken, headers);
|
|
816
798
|
}
|
|
817
|
-
;
|
|
818
799
|
/**
|
|
819
800
|
* enrollVerification
|
|
820
801
|
* @param options
|
|
821
802
|
* @returns
|
|
822
803
|
*/
|
|
823
804
|
enrollVerification(options) {
|
|
824
|
-
return
|
|
805
|
+
return VerificationService.enrollVerification(options);
|
|
825
806
|
}
|
|
826
|
-
;
|
|
827
807
|
/**
|
|
828
808
|
* checkVerificationTypeConfigured
|
|
829
809
|
* @param options
|
|
830
810
|
* @returns
|
|
831
811
|
*/
|
|
832
812
|
checkVerificationTypeConfigured(options) {
|
|
833
|
-
return
|
|
813
|
+
return VerificationService.checkVerificationTypeConfigured(options);
|
|
834
814
|
}
|
|
835
|
-
;
|
|
836
815
|
/**
|
|
837
816
|
* deleteUserAccount
|
|
838
817
|
* @param options
|
|
839
818
|
* @returns
|
|
840
819
|
*/
|
|
841
820
|
deleteUserAccount(options) {
|
|
842
|
-
return
|
|
821
|
+
return UserService.deleteUserAccount(options);
|
|
843
822
|
}
|
|
844
|
-
;
|
|
845
823
|
/**
|
|
846
824
|
* getMissingFields
|
|
847
|
-
* @param trackId - required. If only trackId is given, it will get missing fields from cidaas after
|
|
825
|
+
* @param trackId - required. If only trackId is given, it will get missing fields from cidaas after succesful registration using default provider
|
|
848
826
|
* @param useSocialProvider - optional. If given, it will get missing fields from social provider after successful registration using social provider
|
|
849
827
|
*
|
|
850
828
|
* @example
|
|
@@ -861,16 +839,15 @@ class WebAuth {
|
|
|
861
839
|
* ```
|
|
862
840
|
*
|
|
863
841
|
*/
|
|
864
|
-
getMissingFields(trackId, useSocialProvider) {
|
|
842
|
+
getMissingFields(trackId, useSocialProvider, headers) {
|
|
865
843
|
if (useSocialProvider) {
|
|
866
844
|
const _serviceURL = window.webAuthSettings.authority + "/public-srv/public/trackinfo/" + useSocialProvider.requestId + "/" + trackId;
|
|
867
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
845
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
868
846
|
}
|
|
869
847
|
else {
|
|
870
|
-
return
|
|
848
|
+
return TokenService.getMissingFields(trackId, headers);
|
|
871
849
|
}
|
|
872
850
|
}
|
|
873
|
-
;
|
|
874
851
|
/**
|
|
875
852
|
* progressiveRegistration
|
|
876
853
|
* @param options
|
|
@@ -878,39 +855,37 @@ class WebAuth {
|
|
|
878
855
|
* @returns
|
|
879
856
|
*/
|
|
880
857
|
progressiveRegistration(options, headers) {
|
|
881
|
-
return
|
|
858
|
+
return LoginService.progressiveRegistration(options, headers);
|
|
882
859
|
}
|
|
883
|
-
;
|
|
884
860
|
/**
|
|
885
861
|
* loginAfterRegister
|
|
886
862
|
* @param options
|
|
887
863
|
*/
|
|
888
864
|
loginAfterRegister(options) {
|
|
889
|
-
|
|
865
|
+
LoginService.loginAfterRegister(options);
|
|
890
866
|
}
|
|
891
|
-
;
|
|
892
867
|
/**
|
|
893
868
|
* device code flow - initiate
|
|
894
869
|
*/
|
|
895
870
|
initiateDeviceCode(clientId) {
|
|
896
|
-
return
|
|
871
|
+
return TokenService.initiateDeviceCode(clientId);
|
|
897
872
|
}
|
|
898
873
|
/**
|
|
899
874
|
* device code flow - verify
|
|
900
875
|
* @param code
|
|
901
876
|
*/
|
|
902
877
|
deviceCodeVerify(code) {
|
|
903
|
-
|
|
878
|
+
TokenService.deviceCodeVerify(code);
|
|
904
879
|
}
|
|
905
880
|
/**
|
|
906
881
|
* check if an user exists
|
|
907
882
|
* @param options
|
|
883
|
+
* @param headers
|
|
908
884
|
* @returns
|
|
909
885
|
*/
|
|
910
|
-
userCheckExists(options) {
|
|
911
|
-
return
|
|
886
|
+
userCheckExists(options, headers) {
|
|
887
|
+
return UserService.userCheckExists(options, headers);
|
|
912
888
|
}
|
|
913
|
-
;
|
|
914
889
|
/**
|
|
915
890
|
* To set accept language
|
|
916
891
|
* @param acceptLanguage
|
|
@@ -921,31 +896,62 @@ class WebAuth {
|
|
|
921
896
|
/**
|
|
922
897
|
* initiate mfa
|
|
923
898
|
* @param options
|
|
899
|
+
* @param headers
|
|
924
900
|
* @returns
|
|
925
901
|
*/
|
|
926
|
-
initiateMFA(options, accessToken) {
|
|
927
|
-
// TODO: remove accessToken parameter in the next major release
|
|
902
|
+
initiateMFA(options, accessToken, headers) {
|
|
903
|
+
// BREAKING TODO: remove accessToken parameter in the next major release
|
|
928
904
|
if (accessToken) {
|
|
929
|
-
return
|
|
905
|
+
return VerificationService.initiateMFA(options, accessToken, headers);
|
|
930
906
|
}
|
|
931
|
-
return
|
|
907
|
+
return VerificationService.initiateMFA(options, undefined, headers);
|
|
932
908
|
}
|
|
933
|
-
;
|
|
934
909
|
/**
|
|
935
910
|
* authenticate mfa
|
|
936
911
|
* @param options
|
|
912
|
+
* @param headers
|
|
913
|
+
* @returns
|
|
914
|
+
*/
|
|
915
|
+
authenticateMFA(options, headers) {
|
|
916
|
+
return VerificationService.authenticateMFA(options, headers);
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* initiate verification
|
|
920
|
+
* @param options
|
|
921
|
+
* @returns
|
|
922
|
+
*/
|
|
923
|
+
initiateVerification(options, trackId, method) {
|
|
924
|
+
return VerificationService.initiateVerification(options, trackId, method);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* configure verification
|
|
928
|
+
* @param options
|
|
929
|
+
* @returns
|
|
930
|
+
*/
|
|
931
|
+
configureVerification(options, method) {
|
|
932
|
+
return VerificationService.configureVerification(options, method);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* configure friendly name
|
|
936
|
+
* @param options
|
|
937
|
+
* @returns
|
|
938
|
+
*/
|
|
939
|
+
configureFriendlyName(options, trackId, method) {
|
|
940
|
+
return VerificationService.configureFriendlyName(options, trackId, method);
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* login as guest
|
|
944
|
+
* @param requestId
|
|
937
945
|
* @returns
|
|
938
946
|
*/
|
|
939
|
-
|
|
940
|
-
return
|
|
947
|
+
actionGuestLogin(requestId) {
|
|
948
|
+
return LoginService.actionGuestLogin(requestId);
|
|
941
949
|
}
|
|
942
|
-
;
|
|
943
950
|
/**
|
|
944
951
|
* offline token check
|
|
945
952
|
*/
|
|
946
953
|
offlineTokenCheck(accessToken) {
|
|
947
|
-
return
|
|
954
|
+
return TokenService.offlineTokenCheck(accessToken);
|
|
948
955
|
}
|
|
949
|
-
;
|
|
950
956
|
}
|
|
951
957
|
exports.WebAuth = WebAuth;
|