cidaas-javascript-sdk 2.0.10 → 2.0.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cidaas-javascript-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"author": "cidaas by Widas ID GmbH",
|
|
5
5
|
"description": "Cidaas native javascript sdk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"src/main/**/*.{js,jsx,mjs}"
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|
|
@@ -10,6 +10,7 @@ function WebAuth(settings) {
|
|
|
10
10
|
var usermanager = new Oidc.UserManager(settings);
|
|
11
11
|
window.webAuthSettings = settings;
|
|
12
12
|
window.usermanager = usermanager;
|
|
13
|
+
window.localeSettings = null;
|
|
13
14
|
window.authentication = new Authentication(window.webAuthSettings, window.usermanager);
|
|
14
15
|
window.usermanager.events.addSilentRenewError(function (error) {
|
|
15
16
|
throw new CustomException("Error while renewing silent login", 500);
|
|
@@ -134,6 +135,9 @@ WebAuth.prototype.getUserProfile = function (options) {
|
|
|
134
135
|
http.open("GET", _serviceURL, true);
|
|
135
136
|
http.setRequestHeader("Content-type", "application/json");
|
|
136
137
|
http.setRequestHeader("access_token", options.access_token);
|
|
138
|
+
if (window.localeSettings) {
|
|
139
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
140
|
+
}
|
|
137
141
|
http.send();
|
|
138
142
|
} catch (ex) {
|
|
139
143
|
reject(ex);
|
|
@@ -158,6 +162,9 @@ WebAuth.prototype.getProfileInfo = function (access_token) {
|
|
|
158
162
|
http.open("GET", _serviceURL, true);
|
|
159
163
|
http.setRequestHeader("Content-type", "application/json");
|
|
160
164
|
http.setRequestHeader("access_token", access_token);
|
|
165
|
+
if (window.localeSettings) {
|
|
166
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
167
|
+
}
|
|
161
168
|
http.send();
|
|
162
169
|
} catch (ex) {
|
|
163
170
|
reject(ex);
|
|
@@ -237,6 +244,9 @@ function createPostPromise(options, serviceurl, errorResolver, access_token) {
|
|
|
237
244
|
if (access_token) {
|
|
238
245
|
http.setRequestHeader("access_token", access_token);
|
|
239
246
|
}
|
|
247
|
+
if (window.localeSettings) {
|
|
248
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
249
|
+
}
|
|
240
250
|
if (options) {
|
|
241
251
|
http.send(JSON.stringify(options));
|
|
242
252
|
} else {
|
|
@@ -265,6 +275,9 @@ WebAuth.prototype.renewToken = function (options) {
|
|
|
265
275
|
};
|
|
266
276
|
http.open("POST", _serviceURL, true);
|
|
267
277
|
http.setRequestHeader("Content-type", "application/json");
|
|
278
|
+
if (window.localeSettings) {
|
|
279
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
280
|
+
}
|
|
268
281
|
http.send(JSON.stringify(options));
|
|
269
282
|
} catch (ex) {
|
|
270
283
|
reject(ex);
|
|
@@ -339,6 +352,9 @@ WebAuth.prototype.getAccessToken = function (options) {
|
|
|
339
352
|
};
|
|
340
353
|
http.open("POST", _serviceURL, true);
|
|
341
354
|
http.setRequestHeader("Content-type", "application/json");
|
|
355
|
+
if (window.localeSettings) {
|
|
356
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
357
|
+
}
|
|
342
358
|
http.send(JSON.stringify(options));
|
|
343
359
|
} catch (ex) {
|
|
344
360
|
reject(ex);
|
|
@@ -362,6 +378,9 @@ WebAuth.prototype.validateAccessToken = function (options) {
|
|
|
362
378
|
};
|
|
363
379
|
http.open("POST", _serviceURL, true);
|
|
364
380
|
http.setRequestHeader("Content-type", "application/json");
|
|
381
|
+
if (window.localeSettings) {
|
|
382
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
383
|
+
}
|
|
365
384
|
http.send(JSON.stringify(options));
|
|
366
385
|
} catch (ex) {
|
|
367
386
|
reject(ex);
|
|
@@ -403,6 +422,9 @@ WebAuth.prototype.getRequestId = function () {
|
|
|
403
422
|
};
|
|
404
423
|
http.open("POST", _serviceURL, true);
|
|
405
424
|
http.setRequestHeader("Content-type", "application/json");
|
|
425
|
+
if (window.localeSettings) {
|
|
426
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
427
|
+
}
|
|
406
428
|
http.send(JSON.stringify(bodyParams));
|
|
407
429
|
} catch (ex) {
|
|
408
430
|
reject(ex);
|
|
@@ -476,6 +498,9 @@ WebAuth.prototype.getMissingFields = function (options) {
|
|
|
476
498
|
};
|
|
477
499
|
http.open("GET", _serviceURL, true);
|
|
478
500
|
http.setRequestHeader("Content-type", "application/json");
|
|
501
|
+
if (window.localeSettings) {
|
|
502
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
503
|
+
}
|
|
479
504
|
http.send();
|
|
480
505
|
} catch (ex) {
|
|
481
506
|
reject(ex);
|
|
@@ -500,6 +525,9 @@ WebAuth.prototype.getTenantInfo = function () {
|
|
|
500
525
|
};
|
|
501
526
|
http.open("GET", _serviceURL, true);
|
|
502
527
|
http.setRequestHeader("Content-type", "application/json");
|
|
528
|
+
if (window.localeSettings) {
|
|
529
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
530
|
+
}
|
|
503
531
|
http.send();
|
|
504
532
|
} catch (ex) {
|
|
505
533
|
reject(ex);
|
|
@@ -533,6 +561,9 @@ WebAuth.prototype.getClientInfo = function (options) {
|
|
|
533
561
|
};
|
|
534
562
|
http.open("GET", _serviceURL, true);
|
|
535
563
|
http.setRequestHeader("Content-type", "application/json");
|
|
564
|
+
if (window.localeSettings) {
|
|
565
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
566
|
+
}
|
|
536
567
|
http.send();
|
|
537
568
|
} catch (ex) {
|
|
538
569
|
reject(ex);
|
|
@@ -561,6 +592,9 @@ WebAuth.prototype.getRegistrationSetup = function (options) {
|
|
|
561
592
|
};
|
|
562
593
|
http.open("GET", _serviceURL, true);
|
|
563
594
|
http.setRequestHeader("Content-type", "application/json");
|
|
595
|
+
if (window.localeSettings) {
|
|
596
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
597
|
+
}
|
|
564
598
|
http.send();
|
|
565
599
|
} catch (ex) {
|
|
566
600
|
reject(ex);
|
|
@@ -595,6 +629,8 @@ WebAuth.prototype.register = function (options, headers) {
|
|
|
595
629
|
}
|
|
596
630
|
if (headers.acceptlanguage) {
|
|
597
631
|
http.setRequestHeader("accept-language", headers.acceptlanguage);
|
|
632
|
+
} else if (window.localeSettings) {
|
|
633
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
598
634
|
}
|
|
599
635
|
if (headers.bot_captcha_response) {
|
|
600
636
|
http.setRequestHeader("bot_captcha_response", headers.bot_captcha_response);
|
|
@@ -627,6 +663,9 @@ WebAuth.prototype.getInviteUserDetails = function (options) {
|
|
|
627
663
|
};
|
|
628
664
|
http.open("GET", _serviceURL, true);
|
|
629
665
|
http.setRequestHeader("Content-type", "application/json");
|
|
666
|
+
if (window.localeSettings) {
|
|
667
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
668
|
+
}
|
|
630
669
|
http.send();
|
|
631
670
|
} catch (ex) {
|
|
632
671
|
reject(ex);
|
|
@@ -654,6 +693,9 @@ WebAuth.prototype.getCommunicationStatus = function (options) {
|
|
|
654
693
|
if (options.requestId) {
|
|
655
694
|
http.setRequestHeader("requestId", options.requestId);
|
|
656
695
|
}
|
|
696
|
+
if (window.localeSettings) {
|
|
697
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
698
|
+
}
|
|
657
699
|
http.send();
|
|
658
700
|
} catch (ex) {
|
|
659
701
|
reject(ex);
|
|
@@ -769,6 +811,9 @@ WebAuth.prototype.getMFAList = function (options) {
|
|
|
769
811
|
};
|
|
770
812
|
http.open("GET", _serviceURL, true);
|
|
771
813
|
http.setRequestHeader("Content-type", "application/json");
|
|
814
|
+
if (window.localeSettings) {
|
|
815
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
816
|
+
}
|
|
772
817
|
http.send();
|
|
773
818
|
} catch (ex) {
|
|
774
819
|
reject(ex);
|
|
@@ -1037,6 +1082,9 @@ WebAuth.prototype.getConsentDetails = function (options) {
|
|
|
1037
1082
|
};
|
|
1038
1083
|
http.open("GET", _serviceURL, true);
|
|
1039
1084
|
http.setRequestHeader("Content-type", "application/json");
|
|
1085
|
+
if (window.localeSettings) {
|
|
1086
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1087
|
+
}
|
|
1040
1088
|
http.send();
|
|
1041
1089
|
} catch (ex) {
|
|
1042
1090
|
reject(ex);
|
|
@@ -1078,6 +1126,9 @@ WebAuth.prototype.getScopeConsentDetails = function (options) {
|
|
|
1078
1126
|
};
|
|
1079
1127
|
http.open("GET", _serviceURL, true);
|
|
1080
1128
|
http.setRequestHeader("Content-type", "application/json");
|
|
1129
|
+
if (window.localeSettings) {
|
|
1130
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1131
|
+
}
|
|
1081
1132
|
http.send();
|
|
1082
1133
|
} catch (ex) {
|
|
1083
1134
|
reject(ex);
|
|
@@ -1103,6 +1154,9 @@ WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
|
|
|
1103
1154
|
http.open("GET", _serviceURL, true);
|
|
1104
1155
|
http.setRequestHeader("Content-type", "application/json");
|
|
1105
1156
|
http.setRequestHeader("Authorization", "Bearer " + options.access_token);
|
|
1157
|
+
if (window.localeSettings) {
|
|
1158
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1159
|
+
}
|
|
1106
1160
|
http.send();
|
|
1107
1161
|
} catch (ex) {
|
|
1108
1162
|
reject(ex);
|
|
@@ -1166,6 +1220,9 @@ WebAuth.prototype.getDeduplicationDetails = function (options) {
|
|
|
1166
1220
|
};
|
|
1167
1221
|
http.open("GET", _serviceURL, true);
|
|
1168
1222
|
http.setRequestHeader("Content-type", "application/json");
|
|
1223
|
+
if (window.localeSettings) {
|
|
1224
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1225
|
+
}
|
|
1169
1226
|
http.send();
|
|
1170
1227
|
} catch (ex) {
|
|
1171
1228
|
reject(ex);
|
|
@@ -1199,6 +1256,9 @@ WebAuth.prototype.registerDeduplication = function (options) {
|
|
|
1199
1256
|
};
|
|
1200
1257
|
http.open("POST", _serviceURL, true);
|
|
1201
1258
|
http.setRequestHeader("Content-type", "application/json");
|
|
1259
|
+
if (window.localeSettings) {
|
|
1260
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1261
|
+
}
|
|
1202
1262
|
http.send();
|
|
1203
1263
|
} catch (ex) {
|
|
1204
1264
|
reject(ex);
|
|
@@ -1301,6 +1361,9 @@ WebAuth.prototype.updateProfile = function (options, access_token, sub) {
|
|
|
1301
1361
|
http.open("PUT", _serviceURL, true);
|
|
1302
1362
|
http.setRequestHeader("Content-type", "application/json");
|
|
1303
1363
|
http.setRequestHeader("access_token", access_token);
|
|
1364
|
+
if (window.localeSettings) {
|
|
1365
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1366
|
+
}
|
|
1304
1367
|
http.send(JSON.stringify(options));
|
|
1305
1368
|
} catch (ex) {
|
|
1306
1369
|
throw new CustomException(ex, 417);
|
|
@@ -1332,6 +1395,9 @@ WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
|
|
|
1332
1395
|
http.open("GET", _serviceURL, true);
|
|
1333
1396
|
http.setRequestHeader("Content-type", "application/json");
|
|
1334
1397
|
http.setRequestHeader("access_token", access_token);
|
|
1398
|
+
if (window.localeSettings) {
|
|
1399
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1400
|
+
}
|
|
1335
1401
|
http.send();
|
|
1336
1402
|
} catch (ex) {
|
|
1337
1403
|
throw new CustomException(ex, 417);
|
|
@@ -1357,6 +1423,9 @@ WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
|
|
|
1357
1423
|
http.open("GET", _serviceURL, true);
|
|
1358
1424
|
http.setRequestHeader("Content-type", "application/json");
|
|
1359
1425
|
http.setRequestHeader("access_token", access_token);
|
|
1426
|
+
if (window.localeSettings) {
|
|
1427
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1428
|
+
}
|
|
1360
1429
|
http.send();
|
|
1361
1430
|
} catch (ex) {
|
|
1362
1431
|
throw new CustomException(ex, 417);
|
|
@@ -1382,6 +1451,9 @@ WebAuth.prototype.reviewDevice = function (options, access_token, sub) {
|
|
|
1382
1451
|
http.open("PUT", _serviceURL, true);
|
|
1383
1452
|
http.setRequestHeader("Content-type", "application/json");
|
|
1384
1453
|
http.setRequestHeader("access_token", access_token);
|
|
1454
|
+
if (window.localeSettings) {
|
|
1455
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1456
|
+
}
|
|
1385
1457
|
http.send(JSON.stringify(options));
|
|
1386
1458
|
} catch (ex) {
|
|
1387
1459
|
throw new CustomException(ex, 417);
|
|
@@ -1413,6 +1485,9 @@ WebAuth.prototype.viewAcceptedConsent = function (options, access_token) {
|
|
|
1413
1485
|
http.open("GET", _serviceURL, true);
|
|
1414
1486
|
http.setRequestHeader("Content-type", "application/json");
|
|
1415
1487
|
http.setRequestHeader("access_token", access_token);
|
|
1488
|
+
if (window.localeSettings) {
|
|
1489
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1490
|
+
}
|
|
1416
1491
|
http.send();
|
|
1417
1492
|
} catch (ex) {
|
|
1418
1493
|
throw new CustomException(ex, 417);
|
|
@@ -1615,6 +1690,9 @@ WebAuth.prototype.authenticateFaceVerification = function (options) {
|
|
|
1615
1690
|
};
|
|
1616
1691
|
http.open("POST", _serviceURL, true);
|
|
1617
1692
|
http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
|
|
1693
|
+
if (window.localeSettings) {
|
|
1694
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1695
|
+
}
|
|
1618
1696
|
http.send(JSON.stringify(options));
|
|
1619
1697
|
} catch (ex) {
|
|
1620
1698
|
reject(ex);
|
|
@@ -1651,6 +1729,9 @@ WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
|
|
|
1651
1729
|
};
|
|
1652
1730
|
http.open("GET", _serviceURL, true);
|
|
1653
1731
|
http.setRequestHeader("Content-type", "application/json");
|
|
1732
|
+
if (window.localeSettings) {
|
|
1733
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1734
|
+
}
|
|
1654
1735
|
http.send();
|
|
1655
1736
|
} catch (ex) {
|
|
1656
1737
|
reject(ex);
|
|
@@ -1679,6 +1760,8 @@ WebAuth.prototype.progressiveRegistration = function (options, headers) {
|
|
|
1679
1760
|
http.setRequestHeader("trackId", headers.trackId);
|
|
1680
1761
|
if (headers.acceptlanguage) {
|
|
1681
1762
|
http.setRequestHeader("accept-language", headers.acceptlanguage);
|
|
1763
|
+
} else if (window.localeSettings) {
|
|
1764
|
+
http.setRequestHeader("accept-language", window.localeSettings);
|
|
1682
1765
|
}
|
|
1683
1766
|
http.send(JSON.stringify(options));
|
|
1684
1767
|
} catch (ex) {
|
|
@@ -1715,4 +1798,8 @@ WebAuth.prototype.userCheckExists = function (options) {
|
|
|
1715
1798
|
return createPostPromise(options, _serviceURL, undefined);
|
|
1716
1799
|
};
|
|
1717
1800
|
|
|
1801
|
+
WebAuth.prototype.setAcceptLanguageHeader = function(acceptLanguage) {
|
|
1802
|
+
window.localeSettings = acceptLanguage;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1718
1805
|
module.exports = WebAuth;
|