cidaas-javascript-sdk 3.1.3 → 3.1.4

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.
@@ -1,1516 +0,0 @@
1
- import { UserManager, UserManagerSettings } from "oidc-client-ts";
2
- import * as CryptoJS from 'crypto-js';
3
-
4
- import { Authentication } from "../authentication";
5
- import { Helper, CustomException } from "./Helper";
6
- import { LoginService } from "./LoginService";
7
- import { UserService } from "./UserService";
8
- import { TokenService } from "./TokenService";
9
- import { VerificationService } from "./VerificationService";
10
- import { ConsentService } from "./ConsentService";
11
-
12
- import {
13
- AccessTokenRequest,
14
- TokenIntrospectionEntity,
15
- UserEntity,
16
- ResetPasswordEntity,
17
- IConfiguredListRequestEntity,
18
- IInitVerificationAuthenticationRequestEntity,
19
- FindUserEntity,
20
- IUserEntity,
21
- FidoSetupEntity,
22
- IEnrollVerificationSetupRequestEntity,
23
- ISuggestedMFAActionConfig,
24
- IUserLinkEntity,
25
- UpdateReviewDeviceEntity,
26
- UserActivityEntity,
27
- ChangePasswordEntity,
28
- IConsentAcceptEntity,
29
- IAuthVerificationAuthenticationRequestEntity,
30
- FaceVerificationAuthenticationRequestEntity,
31
- LoginFormRequestEntity,
32
- AccountVerificationRequestEntity,
33
- ValidateResetPasswordEntity,
34
- AcceptResetPasswordEntity,
35
- LoginFormRequestAsyncEntity,
36
- PhysicalVerificationLoginRequest,
37
- IChangePasswordEntity,
38
- ICidaasSDKSettings
39
- } from "./Entities"
40
-
41
- export class WebAuth {
42
-
43
- constructor(settings: ICidaasSDKSettings) {
44
- try {
45
- if (!settings.response_type) {
46
- settings.response_type = "code";
47
- }
48
- if (!settings.scope) {
49
- settings.scope = "email openid profile mobile";
50
- }
51
- if (!settings.mode) {
52
- settings.mode = 'redirect';
53
- }
54
- if (!settings.cidaas_version) {
55
- settings.cidaas_version = 2;
56
- }
57
- var usermanager = new UserManager(settings)
58
- window.webAuthSettings = settings;
59
- window.usermanager = usermanager;
60
- window.localeSettings = null;
61
- window.authentication = new Authentication(window.webAuthSettings, window.usermanager);
62
- window.usermanager.events.addSilentRenewError(function (error: any) {
63
- throw new CustomException("Error while renewing silent login", 500);
64
- });
65
- } catch (ex) {
66
- console.log(ex);
67
- }
68
- }
69
-
70
- /**
71
- * @param string
72
- * @returns
73
- */
74
- private base64URL(string: any) {
75
- return string.toString(CryptoJS.enc.Base64).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
76
- };
77
-
78
- // prototype methods
79
- /**
80
- * login
81
- */
82
- loginWithBrowser() {
83
- try {
84
- if (!window.webAuthSettings && !window.authentication) {
85
- throw new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
86
- }
87
- switch (window.webAuthSettings.mode) {
88
- case 'redirect':
89
- window.authentication.redirectSignIn('login');
90
- break;
91
- case 'window':
92
- window.authentication.popupSignIn();
93
- break;
94
- case 'silent':
95
- window.authentication.silentSignIn();
96
- break;
97
- }
98
- } catch (ex) {
99
- console.log(ex);
100
- }
101
- };
102
-
103
- /**
104
- * register
105
- */
106
- registerWithBrowser() {
107
- try {
108
- if (!window.webAuthSettings && !window.authentication) {
109
- throw new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
110
- }
111
- switch (window.webAuthSettings.mode) {
112
- case 'redirect':
113
- window.authentication.redirectSignIn('register');
114
- break;
115
- case 'window':
116
- window.authentication.popupSignIn();
117
- break;
118
- case 'silent':
119
- window.authentication.silentSignIn();
120
- break;
121
- }
122
- } catch (ex) {
123
- console.log(ex);
124
- }
125
- };
126
-
127
- /**
128
- * login callback
129
- * @returns
130
- */
131
- loginCallback() {
132
- return new Promise((resolve, reject) => {
133
- try {
134
- if (!window.webAuthSettings && !window.authentication) {
135
- throw new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
136
- }
137
- switch (window.webAuthSettings.mode) {
138
- case 'redirect':
139
- window.authentication.redirectSignInCallback().then(function (user: any) {
140
- resolve(user);
141
- }).catch(function (ex: any) {
142
- reject(ex);
143
- });
144
- break;
145
- case 'window':
146
- window.authentication.popupSignInCallback();
147
- break;
148
- case 'silent':
149
- window.authentication.silentSignInCallbackV2().then(function (data: any) {
150
- resolve(data);
151
- }).catch(function (error: any) {
152
- reject(error);
153
- })
154
- break;
155
- }
156
- } catch (ex) {
157
- console.log(ex);
158
- }
159
- });
160
- };
161
-
162
- /**
163
- * get user info
164
- * @returns
165
- */
166
- async getUserInfo() {
167
- try {
168
- if (window.usermanager) {
169
- return await window.usermanager.getUser();
170
- } else {
171
- throw new CustomException("UserManager cannot be empty", 417);
172
- }
173
- } catch (e) {
174
- throw e
175
- }
176
- };
177
-
178
-
179
- /**
180
- * logout
181
- * @returns
182
- */
183
- logout() {
184
- return new Promise((resolve, reject) => {
185
- try {
186
- if (!window.webAuthSettings && !window.authentication) {
187
- throw new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
188
- }
189
- if (window.webAuthSettings.mode == 'redirect') {
190
- window.authentication.redirectSignOut().then(function (result: any) {
191
- resolve(result);
192
- return;
193
- });
194
- } else if (window.webAuthSettings.mode == 'window') {
195
- window.authentication.popupSignOut();
196
- } else if (window.webAuthSettings.mode == 'silent') {
197
- window.authentication.redirectSignOut();
198
- } else {
199
- resolve(undefined);
200
- }
201
- } catch (ex) {
202
- reject(ex);
203
- }
204
- });
205
- };
206
-
207
- /**
208
- * logout callback
209
- * @returns
210
- */
211
- logoutCallback() {
212
- return new Promise((resolve, reject) => {
213
- try {
214
- if (!window.webAuthSettings && !window.authentication) {
215
- throw new CustomException("Settings or Authentication instance in OIDC cannot be empty", 417);
216
- }
217
- if (window.webAuthSettings.mode == 'redirect') {
218
- window.authentication.redirectSignOutCallback().then(function (resp: any) {
219
- resolve(resp);
220
- });
221
- } else if (window.webAuthSettings.mode == 'window') {
222
- window.authentication.popupSignOutCallback();
223
- } else if (window.webAuthSettings.mode == 'silent') {
224
- window.authentication.redirectSignOutCallback();
225
- }
226
- } catch (ex) {
227
- reject(ex);
228
- }
229
- });
230
- };
231
-
232
- /**
233
- * get login url
234
- * @returns
235
- */
236
- getLoginURL() {
237
- let loginUrl: string;
238
- let finish: boolean = false;
239
- (async () => {
240
- try {
241
- loginUrl = await window.usermanager._client.getSignInRedirectUrl();
242
- }
243
- catch (e) {
244
- //TODO: define Error handling
245
- console.log(e);
246
- }
247
- finish = true
248
- })();
249
- while (!finish) { } // A simple synchronous loop to wait async call is finish
250
- return loginUrl;
251
- };
252
-
253
- /**
254
- * get request id
255
- * @returns
256
- */
257
- getRequestId() {
258
- return new Promise((resolve, reject) => {
259
- try {
260
- var respone_type = window.webAuthSettings.response_type;
261
- if (!respone_type) {
262
- respone_type = "token";
263
- }
264
- var response_mode = window.webAuthSettings.response_mode;
265
- if (!response_mode) {
266
- response_mode = "fragment";
267
- }
268
- var bodyParams = {
269
- "client_id": window.webAuthSettings.client_id,
270
- "redirect_uri": window.webAuthSettings.redirect_uri,
271
- "response_type": respone_type,
272
- "response_mode": response_mode,
273
- "scope": window.webAuthSettings.scope,
274
- "nonce": new Date().getTime().toString()
275
- };
276
- var http = new XMLHttpRequest();
277
- var _serviceURL = window.webAuthSettings.authority + "/authz-srv/authrequest/authz/generate";
278
- http.onreadystatechange = function () {
279
- if (http.readyState == 4) {
280
- if (http.responseText) {
281
- resolve(JSON.parse(http.responseText));
282
- } else {
283
- resolve(false);
284
- }
285
- }
286
- };
287
- http.open("POST", _serviceURL, true);
288
- http.setRequestHeader("Content-type", "application/json");
289
- if (window.localeSettings) {
290
- http.setRequestHeader("accept-language", window.localeSettings);
291
- }
292
- http.send(JSON.stringify(bodyParams));
293
- } catch (ex) {
294
- reject(ex);
295
- }
296
- });
297
- };
298
-
299
- /**
300
- * get missing fields
301
- * @param options
302
- * @returns
303
- */
304
- getMissingFields(options: { requestId: string; trackId: string; }) {
305
- const _serviceURL = window.webAuthSettings.authority + "/public-srv/public/trackinfo/" + options.requestId + "/" + options.trackId;
306
- return Helper.createPostPromise(undefined, _serviceURL,false, "GET");
307
- };
308
-
309
- /**
310
- * get Tenant info
311
- * @returns
312
- */
313
- getTenantInfo() {
314
- const _serviceURL = window.webAuthSettings.authority + "/public-srv/tenantinfo/basic";
315
- return Helper.createPostPromise(undefined, _serviceURL,false, "GET");
316
- };
317
-
318
- /**
319
- * logout api call
320
- * @param options
321
- */
322
- logoutUser(options: { access_token: string }) {
323
- try {
324
- 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;
325
- } catch (ex) {
326
- throw new CustomException(ex, 417);
327
- }
328
- };
329
-
330
- /**
331
- * get Client Info
332
- * @param options
333
- * @returns
334
- */
335
- getClientInfo(options: { requestId: string }) {
336
- const _serviceURL = window.webAuthSettings.authority + "/public-srv/public/" + options.requestId;
337
- return Helper.createPostPromise(undefined, _serviceURL,false, "GET");
338
- };
339
-
340
- /**
341
- * get all devices associated to the client
342
- * @param options
343
- * @returns
344
- */
345
- getDevicesInfo(options: any) {
346
- options.userAgent = window.navigator.userAgent;
347
- const _serviceURL = window.webAuthSettings.authority + "/device-srv/devices";
348
- if (window.navigator.userAgent) {
349
- return Helper.createPostPromise(options, _serviceURL,false, "GET");
350
- }
351
- return Helper.createPostPromise(undefined, _serviceURL,false, "GET");
352
- };
353
-
354
- /**
355
- * delete a device
356
- * @param options
357
- * @returns
358
- */
359
- deleteDevice(options: { device_id: string; userAgent?: string }) {
360
- const _serviceURL = window.webAuthSettings.authority + "/device-srv/device/" + options.device_id;
361
- options.userAgent = window.navigator.userAgent;
362
- if (window.navigator.userAgent) {
363
- return Helper.createPostPromise(options, _serviceURL,false, "DELETE");
364
- }
365
- return Helper.createPostPromise(undefined, _serviceURL,false, "DELETE");
366
- };
367
-
368
- /**
369
- * get Registration setup
370
- * @param options
371
- * @returns
372
- */
373
- getRegistrationSetup(options: { acceptlanguage: string; requestId: string }) {
374
- return new Promise((resolve, reject) => {
375
- try {
376
- var http = new XMLHttpRequest();
377
- var _serviceURL = window.webAuthSettings.authority + "/registration-setup-srv/public/list?acceptlanguage=" + options.acceptlanguage + "&requestId=" + options.requestId;
378
- http.onreadystatechange = function () {
379
- if (http.readyState == 4) {
380
- if (http.responseText) {
381
- var parsedResponse = JSON.parse(http.responseText);
382
- if (parsedResponse && parsedResponse.data && parsedResponse.data.length > 0) {
383
- let registrationFields = parsedResponse.data;
384
- }
385
- resolve(parsedResponse);
386
- } else {
387
- resolve(false);
388
- }
389
- }
390
- };
391
- http.open("GET", _serviceURL, true);
392
- http.setRequestHeader("Content-type", "application/json");
393
- if (window.localeSettings) {
394
- http.setRequestHeader("accept-language", window.localeSettings);
395
- }
396
- http.send();
397
- } catch (ex) {
398
- reject(ex);
399
- }
400
- });
401
- };
402
-
403
- /**
404
- * get unreviewed devices
405
- * @param access_token
406
- * @param sub
407
- * @returns
408
- */
409
- getUnreviewedDevices(access_token: string, sub: string) {
410
- let _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/unreviewlist/" + sub;
411
- return Helper.createPostPromise(undefined, _serviceURL,false, "GET", access_token);
412
- };
413
-
414
- /**
415
- * get reviewed devices
416
- * @param access_token
417
- * @param sub
418
- * @returns
419
- */
420
- getReviewedDevices(access_token: string, sub: string) {
421
- let _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/reviewlist/" + sub;
422
- return Helper.createPostPromise(undefined, _serviceURL,false, "GET", access_token);
423
- };
424
-
425
- /**
426
- * review device
427
- * @param options
428
- * @param access_token
429
- * @returns
430
- */
431
- reviewDevice(options: UpdateReviewDeviceEntity, access_token: string) {
432
- let _serviceURL = window.webAuthSettings.authority + "/reports-srv/device/updatereview";
433
- return Helper.createPostPromise(options, _serviceURL,false, "PUT", access_token);
434
- };
435
-
436
- /**
437
- * get device info
438
- * @returns
439
- */
440
- getDeviceInfo() {
441
- return new Promise((resolve, reject) => {
442
- try {
443
- var value = ('; ' + document.cookie).split(`; cidaas_dr=`).pop().split(';')[0];
444
- var options = { userAgent: "" };
445
- if (!value) {
446
- (async () => {
447
- options.userAgent = window.navigator.userAgent
448
- var http = new XMLHttpRequest();
449
- var _serviceURL = window.webAuthSettings.authority + "/device-srv/deviceinfo";
450
- http.onreadystatechange = function () {
451
- if (http.readyState == 4) {
452
- resolve(JSON.parse(http.responseText));
453
- }
454
- };
455
- http.open("POST", _serviceURL, true);
456
- http.setRequestHeader("Content-type", "application/json");
457
- if (window.localeSettings) {
458
- http.setRequestHeader("accept-language", window.localeSettings);
459
- }
460
- http.send(JSON.stringify(options));
461
- })();
462
- }
463
- } catch (ex) {
464
- reject(ex);
465
- }
466
- });
467
- };
468
-
469
- /**
470
- * get user info
471
- * @param options
472
- * @returns
473
- */
474
- getUserProfile(options: { access_token: string }) {
475
- return UserService.getUserProfile(options);
476
- };
477
-
478
- /**
479
- * renew token using refresh token
480
- * @param options
481
- * @returns
482
- */
483
- renewToken(options: AccessTokenRequest) {
484
- return TokenService.renewToken(options);
485
- };
486
-
487
- /**
488
- * get access token from code
489
- * @param options
490
- * @returns
491
- */
492
- getAccessToken(options: AccessTokenRequest) {
493
- return TokenService.getAccessToken(options);
494
- };
495
-
496
- /**
497
- * validate access token
498
- * @param options
499
- * @returns
500
- */
501
- validateAccessToken(options: TokenIntrospectionEntity) {
502
- return TokenService.validateAccessToken(options);
503
- };
504
-
505
- /**
506
- * login with username and password
507
- * @param options
508
- */
509
- loginWithCredentials(options: LoginFormRequestEntity) {
510
- LoginService.loginWithCredentials(options);
511
- };
512
-
513
- /**
514
- * login with username and password and return response
515
- * @param options
516
- * @returns
517
- */
518
- async loginWithCredentialsAsynFn(options: LoginFormRequestAsyncEntity) {
519
- await LoginService.loginWithCredentialsAsynFn(options);
520
- };
521
-
522
- /**
523
- * login with social
524
- * @param options
525
- * @param queryParams
526
- */
527
- loginWithSocial(options: { provider: string; requestId: string; }, queryParams: { dc: string; device_fp: string }) {
528
- LoginService.loginWithSocial(options, queryParams)
529
- };
530
-
531
- /**
532
- * register with social
533
- * @param options
534
- * @param queryParams
535
- */
536
- registerWithSocial(options: { provider: string; requestId: string; }, queryParams: { dc: string; device_fp: string }) {
537
- LoginService.registerWithSocial(options, queryParams)
538
- };
539
-
540
- /**
541
- * register user
542
- * @param options
543
- * @param headers
544
- * @returns
545
- */
546
- register(options: UserEntity, headers: { requestId: string; captcha?: string; acceptlanguage?: string; bot_captcha_response?: string; trackId?: string; }) {
547
- return UserService.register(options, headers);
548
- };
549
-
550
- /**
551
- * get invite info
552
- * @param options
553
- * @returns
554
- */
555
- getInviteUserDetails(options: { invite_id: string }) {
556
- return UserService.getInviteUserDetails(options);
557
- };
558
-
559
- /**
560
- * get Communication status
561
- * @param options
562
- * @returns
563
- */
564
- getCommunicationStatus(options: { sub: string, requestId: string }) {
565
- return UserService.getCommunicationStatus(options);
566
- };
567
-
568
- /**
569
- * initiate verification
570
- * @param options
571
- * @returns
572
- */
573
- initiateAccountVerification(options: AccountVerificationRequestEntity) {
574
- VerificationService.initiateAccountVerification(options);
575
- };
576
-
577
- /**
578
- * initiate verification and return response
579
- * @param options
580
- * @returns
581
- */
582
- async initiateAccountVerificationAsynFn(options: AccountVerificationRequestEntity) {
583
- return await VerificationService.initiateAccountVerificationAsynFn(options);
584
- };
585
-
586
- /**
587
- * verify account
588
- * @param options
589
- * @returns
590
- */
591
- verifyAccount(options: { accvid: string; code: string; }) {
592
- return VerificationService.verifyAccount(options)
593
- };
594
-
595
- /**
596
- * initiate reset password
597
- * @param options
598
- * @returns
599
- */
600
- initiateResetPassword(options: ResetPasswordEntity) {
601
- return UserService.initiateResetPassword(options);
602
- };
603
-
604
- /**
605
- * handle reset password
606
- * @param options
607
- */
608
- handleResetPassword(options: ValidateResetPasswordEntity) {
609
- return UserService.handleResetPassword(options);
610
- };
611
-
612
- /**
613
- * reset password
614
- * @param options
615
- */
616
- resetPassword(options: AcceptResetPasswordEntity) {
617
- return UserService.resetPassword(options);
618
- };
619
-
620
- /**
621
- * get mfa list v2
622
- * @param options
623
- * @returns
624
- */
625
- getMFAListV2(options: IConfiguredListRequestEntity) {
626
- return VerificationService.getMFAListV2(options);
627
- };
628
-
629
- /**
630
- * cancel mfa v2
631
- * @param options
632
- * @returns
633
- */
634
- cancelMFAV2(options: { exchange_id: string; reason: string; type: string; }) {
635
- return VerificationService.cancelMFAV2(options);
636
- };
637
-
638
- /**
639
- * passwordless login
640
- * @param options
641
- */
642
- passwordlessLogin(options: PhysicalVerificationLoginRequest) {
643
- LoginService.passwordlessLogin(options);
644
- };
645
-
646
- /**
647
- * get user consent details
648
- * @param options
649
- * @returns
650
- */
651
- getConsentDetailsV2(options: { consent_id: string; consent_version_id: string; sub: string; }) {
652
- return ConsentService.getConsentDetailsV2(options);
653
- };
654
-
655
- /**
656
- * accept consent v2
657
- * @param options
658
- * @returns
659
- */
660
- acceptConsentV2(options: IConsentAcceptEntity) {
661
- return ConsentService.acceptConsentV2(options);
662
- };
663
-
664
- /**
665
- * get scope consent details
666
- * @param options
667
- * @returns
668
- */
669
- getScopeConsentDetails(options: { track_id: string; locale: string; }) {
670
- return TokenService.getScopeConsentDetails(options);
671
- };
672
-
673
- /**
674
- * get scope consent version details
675
- * @param options
676
- * @returns
677
- */
678
- getScopeConsentVersionDetailsV2(options: { scopeid: string; locale: string; access_token: string; }) {
679
- return ConsentService.getScopeConsentVersionDetailsV2(options);
680
- };
681
-
682
- /**
683
- * accept scope Consent
684
- * @param options
685
- * @returns
686
- */
687
- acceptScopeConsent(options: { client_id: string; sub: string; scopes: string[]; }) {
688
- return ConsentService.acceptScopeConsent(options);
689
- };
690
-
691
- /**
692
- * scope consent continue login
693
- * @param options
694
- */
695
- scopeConsentContinue(options: { track_id: string }) {
696
- LoginService.scopeConsentContinue(options);
697
- };
698
-
699
- /**
700
- * accept claim Consent
701
- * @param options
702
- * @returns
703
- */
704
- acceptClaimConsent(options: { client_id: string; sub: string; accepted_claims: string[]; }) {
705
- return ConsentService.acceptClaimConsent(options);
706
- };
707
-
708
- /**
709
- * claim consent continue login
710
- * @param options
711
- */
712
- claimConsentContinue(options: { track_id: string }) {
713
- LoginService.claimConsentContinue(options);
714
- };
715
-
716
- /**
717
- * revoke claim Consent
718
- * @param options
719
- * @returns
720
- */
721
- revokeClaimConsent(options: { client_id: string; sub: string; revoked_claims: string[]; }) {
722
- return ConsentService.revokeClaimConsent(options);
723
- };
724
-
725
- /**
726
- * get Deduplication details
727
- * @param options
728
- * @returns
729
- */
730
- getDeduplicationDetails(options: { trackId: string }) {
731
- return UserService.getDeduplicationDetails(options);
732
- };
733
-
734
- /**
735
- * deduplication login
736
- * @param options
737
- */
738
- deduplicationLogin(options: { trackId: string, requestId: string, sub: string }) {
739
- UserService.deduplicationLogin(options);
740
- };
741
-
742
- /**
743
- * register Deduplication
744
- * @param options
745
- * @returns
746
- */
747
- registerDeduplication(options: { trackId: string }) {
748
- return UserService.registerDeduplication(options);
749
- };
750
-
751
- /**
752
- * accepts any as the request
753
- * consent continue login
754
- * @param options
755
- */
756
- consentContinue(options: {
757
- client_id: string;
758
- consent_refs: string[];
759
- sub: string;
760
- scopes: string[];
761
- matcher: any;
762
- track_id: string;
763
- }) {
764
- LoginService.consentContinue(options)
765
- };
766
-
767
- /**
768
- * mfa continue login
769
- * @param options
770
- */
771
- mfaContinue(options: PhysicalVerificationLoginRequest & { track_id: string }) {
772
- LoginService.mfaContinue(options);
773
- };
774
-
775
- /**
776
- * change password continue
777
- * @param options
778
- */
779
- firstTimeChangePassword(options: IChangePasswordEntity) {
780
- LoginService.firstTimeChangePassword(options);
781
- };
782
-
783
- /**
784
- * change password
785
- * @param options
786
- * @param access_token
787
- * @returns
788
- */
789
- changePassword(options: ChangePasswordEntity, access_token: string) {
790
- return UserService.changePassword(options, access_token);
791
- };
792
-
793
-
794
- /**
795
- * update profile
796
- * @param options
797
- * @param access_token
798
- * @param sub
799
- * @returns
800
- */
801
- updateProfile(options: UserEntity, access_token: string, sub: string) {
802
- return UserService.updateProfile(options, access_token, sub);
803
- };
804
-
805
- /**
806
- * get user activities
807
- * @param options
808
- * @param access_token
809
- * @returns
810
- */
811
- getUserActivities(options: UserActivityEntity, access_token: string) {
812
- var _serviceURL = window.webAuthSettings.authority + "/useractivity-srv/latestactivity";
813
- return Helper.createPostPromise(options, _serviceURL, false,"POST", access_token);
814
- };
815
-
816
- /**
817
- * @param access_token
818
- * @returns
819
- */
820
- getAllVerificationList(access_token: string) {
821
- return VerificationService.getAllVerificationList(access_token);
822
- };
823
-
824
- /**
825
- * initiate link accoount
826
- * @param options
827
- * @param access_token
828
- * @returns
829
- */
830
- initiateLinkAccount(options: IUserLinkEntity, access_token: string) {
831
- return UserService.initiateLinkAccount(options, access_token);
832
- };
833
-
834
- /**
835
- * complete link accoount
836
- * @param options
837
- * @param access_token
838
- * @returns
839
- */
840
- completeLinkAccount(options: { code?: string; link_request_id?: string; }, access_token: string) {
841
- return UserService.completeLinkAccount(options, access_token);
842
- };
843
-
844
- /**
845
- * get linked users
846
- * @param access_token
847
- * @param sub
848
- * @returns
849
- */
850
- getLinkedUsers(access_token: string, sub: string) {
851
- return UserService.getLinkedUsers(access_token, sub)
852
- };
853
-
854
- /**
855
- * unlink accoount
856
- * @param access_token
857
- * @param identityId
858
- * @returns
859
- */
860
- unlinkAccount(access_token: string, identityId: string) {
861
- return UserService.unlinkAccount(access_token, identityId);
862
- };
863
-
864
- /**
865
- * image upload
866
- * @param options
867
- * @param access_token
868
- * @returns
869
- */
870
- updateProfileImage(options: { image_key: string; }, access_token: string) {
871
- var _serviceURL = window.webAuthSettings.authority + "/image-srv/profile/upload";
872
- return Helper.createPostPromise(options, _serviceURL, false,"POST", access_token);
873
- };
874
-
875
- /**
876
- * updateSuggestMFA
877
- * @param track_id
878
- * @param options
879
- * @returns
880
- */
881
- updateSuggestMFA(track_id: string, options: ISuggestedMFAActionConfig) {
882
- return TokenService.updateSuggestMFA(track_id, options)
883
- };
884
-
885
- /**
886
- * enrollVerification
887
- * @param options
888
- * @returns
889
- */
890
- enrollVerification(options: IEnrollVerificationSetupRequestEntity) {
891
- return VerificationService.enrollVerification(options);
892
- };
893
-
894
- /**
895
- * @deprecated This function is no longer supported, instead use {this.updateStatus()}
896
- * @param status_id
897
- * @returns
898
- */
899
- updateSocket(status_id: string) {
900
- return VerificationService.updateStatus(status_id);
901
- };
902
-
903
- /**
904
- * update the status of notification
905
- * @param status_id
906
- * @returns
907
- */
908
- updateStatus(status_id: string) {
909
- return VerificationService.updateStatus(status_id);
910
- };
911
-
912
- /**
913
- * setupFidoVerification
914
- * @param options
915
- * @returns
916
- */
917
- setupFidoVerification(options: FidoSetupEntity) {
918
- return VerificationService.setupFidoVerification(options);
919
- };
920
-
921
- /**
922
- * checkVerificationTypeConfigured
923
- * @param options
924
- * @returns
925
- */
926
- checkVerificationTypeConfigured(options: IConfiguredListRequestEntity) {
927
- return VerificationService.checkVerificationTypeConfigured(options);
928
- };
929
-
930
- /**
931
- * deleteUserAccount
932
- * @param options
933
- * @returns
934
- */
935
- deleteUserAccount(options: { access_token: string, sub: string }) {
936
- return UserService.deleteUserAccount(options);
937
- };
938
-
939
- /**
940
- * getMissingFieldsLogin
941
- * @param trackId
942
- * @returns
943
- */
944
- getMissingFieldsLogin(trackId: string) {
945
- return TokenService.getMissingFieldsLogin(trackId);
946
- };
947
-
948
- /**
949
- * progressiveRegistration
950
- * @param options
951
- * @param headers
952
- * @returns
953
- */
954
- progressiveRegistration(options: IUserEntity, headers: { requestId: string; trackId: string; acceptlanguage: string; }) {
955
- return LoginService.progressiveRegistration(options, headers);
956
- };
957
-
958
- /**
959
- * loginAfterRegister
960
- * @param options
961
- */
962
- loginAfterRegister(options: { device_id: string; dc?: string; rememberMe: boolean; trackId: string; }) {
963
- LoginService.loginAfterRegister(options);
964
- };
965
-
966
- /**
967
- * device code flow - verify
968
- * @param code
969
- */
970
- deviceCodeVerify(code: string) {
971
- TokenService.deviceCodeVerify(code);
972
- }
973
-
974
- /**
975
- * check if an user exists
976
- * @param options
977
- * @returns
978
- */
979
- userCheckExists(options: FindUserEntity) {
980
- return UserService.userCheckExists(options);
981
- };
982
-
983
- /**
984
- * To set accept language
985
- * @param acceptLanguage
986
- */
987
- setAcceptLanguageHeader(acceptLanguage: string) {
988
- window.localeSettings = acceptLanguage;
989
- }
990
-
991
- /**
992
- * initiate mfa v2
993
- * @param options
994
- * @returns
995
- */
996
- initiateMFAV2(options: IInitVerificationAuthenticationRequestEntity) {
997
- return VerificationService.initiateMFAV2(options);
998
- };
999
-
1000
- /**
1001
- * initiateVerification
1002
- * @param options
1003
- */
1004
- initiateVerification(options: IInitVerificationAuthenticationRequestEntity) {
1005
- options.type = options.verification_type
1006
- this.initiateMFAV2(options);
1007
- };
1008
-
1009
- /**
1010
- * initiate email v2
1011
- * @param options
1012
- */
1013
- initiateEmailV2(options: IInitVerificationAuthenticationRequestEntity) {
1014
- options.type = "email"
1015
- this.initiateMFAV2(options);
1016
- };
1017
-
1018
- /**
1019
- * initiate sms v2
1020
- * @param options
1021
- */
1022
- initiateSMSV2(options: IInitVerificationAuthenticationRequestEntity) {
1023
- options.type = "sms"
1024
- this.initiateMFAV2(options);
1025
- };
1026
-
1027
- /**
1028
- * initiate ivr v2
1029
- * @param options
1030
- */
1031
- initiateIVRV2(options: IInitVerificationAuthenticationRequestEntity) {
1032
- options.type = "ivr"
1033
- this.initiateMFAV2(options);
1034
- };
1035
-
1036
- /**
1037
- * initiate backupcode v2
1038
- * @param options
1039
- */
1040
- initiateBackupcodeV2(options: IInitVerificationAuthenticationRequestEntity) {
1041
- options.type = "backupcode"
1042
- this.initiateMFAV2(options);
1043
- };
1044
-
1045
- /**
1046
- * initiate totp v2
1047
- * @param options
1048
- */
1049
- initiateTOTPV2(options: IInitVerificationAuthenticationRequestEntity) {
1050
- options.type = "totp"
1051
- this.initiateMFAV2(options);
1052
- };
1053
-
1054
- /**
1055
- * initiate pattern v2
1056
- * @param options
1057
- */
1058
- initiatePatternV2(options: IInitVerificationAuthenticationRequestEntity) {
1059
- options.type = "pattern"
1060
- this.initiateMFAV2(options);
1061
- };
1062
-
1063
- /**
1064
- * initiate touchid v2
1065
- * @param options
1066
- */
1067
- initiateTouchIdV2(options: IInitVerificationAuthenticationRequestEntity) {
1068
- options.type = "touchid"
1069
- this.initiateMFAV2(options);
1070
- };
1071
-
1072
- /**
1073
- * initiate smart push v2
1074
- * @param options
1075
- */
1076
- initiateSmartPushV2(options: IInitVerificationAuthenticationRequestEntity) {
1077
- options.type = "push"
1078
- this.initiateMFAV2(options);
1079
- };
1080
-
1081
- /**
1082
- * initiate face v2
1083
- * @param options
1084
- */
1085
- initiateFaceV2(options: IInitVerificationAuthenticationRequestEntity) {
1086
- options.type = "face"
1087
- this.initiateMFAV2(options);
1088
- };
1089
-
1090
- /**
1091
- * initiate voice v2
1092
- * @param options
1093
- */
1094
- initiateVoiceV2(options: IInitVerificationAuthenticationRequestEntity) {
1095
- options.type = "voice"
1096
- this.initiateMFAV2(options);
1097
- };
1098
-
1099
- /**
1100
- * @deprecated
1101
- * @param options
1102
- * @param verificationType
1103
- * @returns
1104
- */
1105
- initiateMfaV1(options: any, verificationType: string) {
1106
- return VerificationService.initiateMfaV1(options, verificationType);
1107
- }
1108
-
1109
- /**
1110
- * @deprecated
1111
- * initiate email - v1
1112
- * @param options
1113
- */
1114
- initiateEmail(options: any) {
1115
- var verificationType = "EMAIL"
1116
- this.initiateMfaV1(options, verificationType)
1117
- };
1118
-
1119
- /**
1120
- * @deprecated
1121
- * initiate SMS - v1
1122
- * @param options
1123
- */
1124
- initiateSMS(options: any) {
1125
- var verificationType = "SMS"
1126
- this.initiateMfaV1(options, verificationType)
1127
- };
1128
-
1129
- /**
1130
- * @deprecated
1131
- * initiate IVR - v1
1132
- * @param options
1133
- */
1134
- initiateIVR(options: any) {
1135
- var verificationType = "IVR"
1136
- this.initiateMfaV1(options, verificationType)
1137
- };
1138
-
1139
- /**
1140
- * @deprecated
1141
- * initiate backup code - v1
1142
- * @param options
1143
- */
1144
- initiateBackupcode(options: any) {
1145
- var verificationType = "BACKUPCODE"
1146
- this.initiateMfaV1(options, verificationType)
1147
- };
1148
-
1149
- /**
1150
- * @deprecated
1151
- * initiate TOTP - v1
1152
- * @param options
1153
- */
1154
- initiateTOTP(options: any) {
1155
- var verificationType = "TOTP";
1156
- this.initiateMfaV1(options, verificationType);
1157
- };
1158
-
1159
- /**
1160
- * @deprecated
1161
- * initiate pattern - v1
1162
- * @param options
1163
- */
1164
- initiatePattern(options: any) {
1165
- var verificationType = "PATTERN";
1166
- this.initiateMfaV1(options, verificationType);
1167
- };
1168
-
1169
- /**
1170
- * @deprecated
1171
- * initiate touchid - v1
1172
- * @param options
1173
- */
1174
- initiateTouchId(options: any) {
1175
- var verificationType = "TOUCHID";
1176
- this.initiateMfaV1(options, verificationType);
1177
- };
1178
-
1179
- /**
1180
- * @deprecated
1181
- * initiate push - v1
1182
- * @param options
1183
- */ initiateSmartPush(options: any) {
1184
- var verificationType = "PUSH";
1185
- this.initiateMfaV1(options, verificationType);
1186
- };
1187
-
1188
- /**
1189
- * @deprecated
1190
- * initiate face - v1
1191
- * @param options
1192
- */
1193
- initiateFace(options: any) {
1194
- var verificationType = "FACE";
1195
- this.initiateMfaV1(options, verificationType);
1196
- };
1197
-
1198
- /**
1199
- * @deprecated
1200
- * initiate Voice - v1
1201
- * @param options
1202
- */
1203
- initiateVoice(options: any) {
1204
- var verificationType = "VOICE";
1205
- this.initiateMfaV1(options, verificationType);
1206
- };
1207
-
1208
- /**
1209
- * authenticate mfa v2
1210
- * @param options
1211
- * @returns
1212
- */
1213
- authenticateMFAV2(options: IAuthVerificationAuthenticationRequestEntity) {
1214
- return VerificationService.authenticateMFAV2(options);
1215
- };
1216
-
1217
- /**
1218
- * authenticateVerification
1219
- * @param options
1220
- */
1221
- authenticateVerification(options: IAuthVerificationAuthenticationRequestEntity) {
1222
- options.type = options.verification_type
1223
- this.authenticateMFAV2(options)
1224
- };
1225
-
1226
- /**
1227
- * authenticate email v2
1228
- * @param options
1229
- */
1230
- authenticateEmailV2(options: IAuthVerificationAuthenticationRequestEntity) {
1231
- options.type = "email";
1232
- this.authenticateMFAV2(options);
1233
- };
1234
-
1235
- /**
1236
- * authenticate sms v2
1237
- * @param options
1238
- */
1239
- authenticateSMSV2(options: IAuthVerificationAuthenticationRequestEntity) {
1240
- options.type = "sms";
1241
- this.authenticateMFAV2(options);
1242
- };
1243
-
1244
- /**
1245
- * authenticate ivr v2
1246
- * @param options
1247
- */
1248
- authenticateIVRV2(options: IAuthVerificationAuthenticationRequestEntity) {
1249
- options.type = "ivr";
1250
- this.authenticateMFAV2(options);
1251
- };
1252
-
1253
- /**
1254
- * authenticate backupcode v2
1255
- * @param options
1256
- */
1257
- authenticateBackupcodeV2(options: IAuthVerificationAuthenticationRequestEntity) {
1258
- options.type = "backupcode";
1259
- this.authenticateMFAV2(options);
1260
- };
1261
-
1262
- /**
1263
- * authenticate totp v2
1264
- * @param options
1265
- */
1266
- authenticateTOTPV2(options: IAuthVerificationAuthenticationRequestEntity) {
1267
- options.type = "totp";
1268
- this.authenticateMFAV2(options);
1269
- };
1270
-
1271
- /**
1272
- * authenticateVerification form type (for face)
1273
- * @param options
1274
- * @returns
1275
- */
1276
- authenticateFaceVerification(options: FaceVerificationAuthenticationRequestEntity) {
1277
- return VerificationService.authenticateFaceVerification(options);
1278
- };
1279
-
1280
- /**
1281
- * @deprecated
1282
- * setup verification - v1
1283
- * @param options
1284
- * @param access_token
1285
- * @param verificationType
1286
- * @returns
1287
- */
1288
- setupVerificationV1(options: any, access_token: string, verificationType: string) {
1289
- return VerificationService.setupVerificationV1(options, access_token, verificationType);
1290
- }
1291
- /**
1292
- * @deprecated
1293
- * setup email - v1
1294
- * @param options
1295
- * @param access_token
1296
- */
1297
- setupEmail(options: any, access_token: string) {
1298
- var verificationType = "EMAIL";
1299
- this.setupVerificationV1(options, access_token, verificationType)
1300
- };
1301
-
1302
- /**
1303
- * @deprecated
1304
- * setup sms - v1
1305
- * @param options
1306
- * @param access_token
1307
- */
1308
- setupSMS(options: any, access_token: string) {
1309
- var verificationType = "SMS";
1310
- this.setupVerificationV1(options, access_token, verificationType)
1311
- };
1312
-
1313
- /**
1314
- * @deprecated
1315
- * setup ivr - v1
1316
- * @param options
1317
- * @param access_token
1318
- */
1319
- setupIVR(options: any, access_token: string) {
1320
- var verificationType = "IVR";
1321
- this.setupVerificationV1(options, access_token, verificationType);
1322
- };
1323
-
1324
- /**
1325
- * @deprecated
1326
- * setup backupcode - v1
1327
- * @param options
1328
- * @param access_token
1329
- */
1330
- setupBackupcode(options: any, access_token: string) {
1331
- var verificationType = "BACKUPCODE";
1332
- this.setupVerificationV1(options, access_token, verificationType);
1333
- };
1334
-
1335
- /**
1336
- * @deprecated
1337
- * setup totp - v1
1338
- * @param options
1339
- * @param access_token
1340
- */
1341
- setupTOTP(options: any, access_token: string) {
1342
- var verificationType = "TOTP";
1343
- this.setupVerificationV1(options, access_token, verificationType);
1344
- };
1345
-
1346
- /**
1347
- * @deprecated
1348
- * setup pattern - v1
1349
- * @param options
1350
- * @param access_token
1351
- */
1352
- setupPattern(options: any, access_token: string) {
1353
- var verificationType = "PATTERN";
1354
- this.setupVerificationV1(options, access_token, verificationType);
1355
- };
1356
-
1357
- /**
1358
- * @deprecated
1359
- * setup touch - v1
1360
- * @param options
1361
- * @param access_token
1362
- */
1363
- setupTouchId(options: any, access_token: string) {
1364
- var verificationType = "TOUCHID";
1365
- this.setupVerificationV1(options, access_token, verificationType);
1366
- };
1367
-
1368
- /**
1369
- * @deprecated
1370
- * setup smart push - v1
1371
- * @param options
1372
- * @param access_token
1373
- */
1374
- setupSmartPush(options: any, access_token: string) {
1375
- var verificationType = "PUSH";
1376
- this.setupVerificationV1(options, access_token, verificationType);
1377
- };
1378
-
1379
- /**
1380
- * @deprecated
1381
- * setup face - v1
1382
- * @param options
1383
- * @param access_token
1384
- */
1385
- setupFace(options: any, access_token: string) {
1386
- var verificationType = "FACE";
1387
- this.setupVerificationV1(options, access_token, verificationType);
1388
- };
1389
-
1390
- /**
1391
- * @deprecated
1392
- * setup voice - v1
1393
- * @param options
1394
- * @param access_token
1395
- */
1396
- setupVoice(options: any, access_token: string) {
1397
- var verificationType = "VOICE";
1398
- this.setupVerificationV1(options, access_token, verificationType);
1399
- };
1400
-
1401
- /**
1402
- * @deprecated
1403
- * enroll verification - v1
1404
- * @param options
1405
- * @param access_token
1406
- * @param verificationType
1407
- * @returns
1408
- */
1409
- enrollVerificationV1(options: any, access_token: string, verificationType: string) {
1410
- return VerificationService.enrollVerificationV1(options, access_token, verificationType);
1411
- }
1412
-
1413
- /**
1414
- * @deprecated
1415
- * enroll email - v1
1416
- * @param options
1417
- * @param access_token
1418
- */
1419
- enrollEmail(options: any, access_token: string) {
1420
- var verificationType = "EMAIL";
1421
- this.enrollVerificationV1(options, access_token, verificationType);
1422
- };
1423
-
1424
- /**
1425
- * @deprecated
1426
- * enroll SMS - v1
1427
- * @param options
1428
- * @param access_token
1429
- */
1430
- enrollSMS(options: any, access_token: string) {
1431
- var verificationType = "SMS";
1432
- this.enrollVerificationV1(options, access_token, verificationType);
1433
- };
1434
-
1435
- /**
1436
- * @deprecated
1437
- * enroll IVR - v1
1438
- * @param options
1439
- * @param access_token
1440
- */
1441
- enrollIVR(options: any, access_token: string) {
1442
- var verificationType = "IVR";
1443
- this.enrollVerificationV1(options, access_token, verificationType);
1444
- };
1445
-
1446
- /**
1447
- * @deprecated
1448
- * enroll TOTP - v1
1449
- * @param options
1450
- * @param access_token
1451
- */
1452
- enrollTOTP(options: any, access_token: string) {
1453
- var verificationType = "TOTP";
1454
- this.enrollVerificationV1(options, access_token, verificationType);
1455
- };
1456
-
1457
- /**
1458
- * @deprecated
1459
- * authenticate mfa - v1
1460
- * @param verificationType
1461
- * @returns
1462
- */
1463
- authenticateMfaV1(options: any, verificationType: string) {
1464
- return VerificationService.authenticateMfaV1(options, verificationType);
1465
- }
1466
-
1467
- /**
1468
- * @deprecated
1469
- * authenticate email - v1
1470
- * @param options
1471
- */
1472
- authenticateEmail(options: any) {
1473
- var verificationType = "EMAIL";
1474
- this.authenticateMfaV1(options, verificationType);
1475
- };
1476
-
1477
- /**
1478
- * @deprecated
1479
- * authenticate sms - v1
1480
- * @param options
1481
- */
1482
- authenticateSMS(options: any) {
1483
- var verificationType = "SMS";
1484
- this.authenticateMfaV1(options, verificationType);
1485
- };
1486
-
1487
- /**
1488
- * @deprecated
1489
- * authenticate ivr - v1
1490
- * @param options
1491
- */
1492
- authenticateIVR(options: any) {
1493
- var verificationType = "IVR";
1494
- this.authenticateMfaV1(options, verificationType);
1495
- };
1496
-
1497
- /**
1498
- * @deprecated
1499
- * authenticate totp - v1
1500
- * @param options
1501
- */
1502
- authenticateTOTP(options: any) {
1503
- var verificationType = "TOTP";
1504
- this.authenticateMfaV1(options, verificationType);
1505
- };
1506
-
1507
- /**
1508
- * @deprecated
1509
- * authenticate backupcode - v1
1510
- * @param options
1511
- */
1512
- authenticateBackupcode(options: any) {
1513
- var verificationType = "BACKUPCODE";
1514
- this.authenticateMfaV1(options, verificationType);
1515
- };
1516
- }