cidaas-javascript-sdk 2.0.8 → 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/README.md CHANGED
@@ -16,9 +16,9 @@ This cidaas Javascript SDK library is built on the top of [OIDC client javascrip
16
16
  From CDN
17
17
 
18
18
  ```html
19
- <!-- Release version 2.0.8 -->
19
+ <!-- Release version 2.0.9 -->
20
20
  <!-- Minified version -->
21
- <script src="https://cdn.cidaas.de/javascript/oidc/2.0.8/cidaas-javascript-sdk.min.js"></script>
21
+ <script src="https://cdn.cidaas.de/javascript/oidc/2.0.9/cidaas-javascript-sdk.min.js"></script>
22
22
  ```
23
23
 
24
24
  From npm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidaas-javascript-sdk",
3
- "version": "2.0.8",
3
+ "version": "2.0.11",
4
4
  "author": "cidaas by Widas ID GmbH",
5
5
  "description": "Cidaas native javascript sdk",
6
6
  "license": "MIT",
@@ -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);
@@ -83,9 +84,9 @@ WebAuth.prototype.loginCallback = function () {
83
84
  } else if (window.webAuthSettings.mode == 'window') {
84
85
  window.authentication.popupSignInCallback();
85
86
  } else if (window.webAuthSettings.mode == 'silent') {
86
- window.authentication.silentSignInCallbackV2().then(function(data){
87
+ window.authentication.silentSignInCallbackV2().then(function (data) {
87
88
  resolve(data);
88
- }).catch(function(error){
89
+ }).catch(function (error) {
89
90
  reject(error);
90
91
  })
91
92
  }
@@ -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,10 +629,16 @@ 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);
601
637
  }
638
+ let trackId = headers.trackid || headers.trackId;
639
+ if (trackId) {
640
+ http.setRequestHeader("trackid", trackId);
641
+ }
602
642
  http.send(JSON.stringify(options));
603
643
  } catch (ex) {
604
644
  reject(ex);
@@ -623,6 +663,9 @@ WebAuth.prototype.getInviteUserDetails = function (options) {
623
663
  };
624
664
  http.open("GET", _serviceURL, true);
625
665
  http.setRequestHeader("Content-type", "application/json");
666
+ if (window.localeSettings) {
667
+ http.setRequestHeader("accept-language", window.localeSettings);
668
+ }
626
669
  http.send();
627
670
  } catch (ex) {
628
671
  reject(ex);
@@ -650,6 +693,9 @@ WebAuth.prototype.getCommunicationStatus = function (options) {
650
693
  if (options.requestId) {
651
694
  http.setRequestHeader("requestId", options.requestId);
652
695
  }
696
+ if (window.localeSettings) {
697
+ http.setRequestHeader("accept-language", window.localeSettings);
698
+ }
653
699
  http.send();
654
700
  } catch (ex) {
655
701
  reject(ex);
@@ -765,6 +811,9 @@ WebAuth.prototype.getMFAList = function (options) {
765
811
  };
766
812
  http.open("GET", _serviceURL, true);
767
813
  http.setRequestHeader("Content-type", "application/json");
814
+ if (window.localeSettings) {
815
+ http.setRequestHeader("accept-language", window.localeSettings);
816
+ }
768
817
  http.send();
769
818
  } catch (ex) {
770
819
  reject(ex);
@@ -1033,6 +1082,9 @@ WebAuth.prototype.getConsentDetails = function (options) {
1033
1082
  };
1034
1083
  http.open("GET", _serviceURL, true);
1035
1084
  http.setRequestHeader("Content-type", "application/json");
1085
+ if (window.localeSettings) {
1086
+ http.setRequestHeader("accept-language", window.localeSettings);
1087
+ }
1036
1088
  http.send();
1037
1089
  } catch (ex) {
1038
1090
  reject(ex);
@@ -1074,6 +1126,9 @@ WebAuth.prototype.getScopeConsentDetails = function (options) {
1074
1126
  };
1075
1127
  http.open("GET", _serviceURL, true);
1076
1128
  http.setRequestHeader("Content-type", "application/json");
1129
+ if (window.localeSettings) {
1130
+ http.setRequestHeader("accept-language", window.localeSettings);
1131
+ }
1077
1132
  http.send();
1078
1133
  } catch (ex) {
1079
1134
  reject(ex);
@@ -1099,6 +1154,9 @@ WebAuth.prototype.getScopeConsentVersionDetailsV2 = function (options) {
1099
1154
  http.open("GET", _serviceURL, true);
1100
1155
  http.setRequestHeader("Content-type", "application/json");
1101
1156
  http.setRequestHeader("Authorization", "Bearer " + options.access_token);
1157
+ if (window.localeSettings) {
1158
+ http.setRequestHeader("accept-language", window.localeSettings);
1159
+ }
1102
1160
  http.send();
1103
1161
  } catch (ex) {
1104
1162
  reject(ex);
@@ -1125,6 +1183,26 @@ WebAuth.prototype.scopeConsentContinue = function (options) {
1125
1183
  }
1126
1184
  };
1127
1185
 
1186
+ // accept claim Consent
1187
+ WebAuth.prototype.acceptClaimConsent = function (options) {
1188
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/accept";
1189
+ return createPostPromise(options, _serviceURL, false);
1190
+ };
1191
+
1192
+ // claim consent continue login
1193
+ WebAuth.prototype.claimConsentContinue = function (options) {
1194
+ try {
1195
+ var form = document.createElement('form');
1196
+ form.action = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.track_id;
1197
+ form.method = 'POST';
1198
+ document.body.appendChild(form);
1199
+ form.submit();
1200
+ } catch (ex) {
1201
+ throw new CustomException(ex, 417);
1202
+ }
1203
+ };
1204
+
1205
+
1128
1206
  // get Deduplication details
1129
1207
  WebAuth.prototype.getDeduplicationDetails = function (options) {
1130
1208
  return new Promise(function (resolve, reject) {
@@ -1142,6 +1220,9 @@ WebAuth.prototype.getDeduplicationDetails = function (options) {
1142
1220
  };
1143
1221
  http.open("GET", _serviceURL, true);
1144
1222
  http.setRequestHeader("Content-type", "application/json");
1223
+ if (window.localeSettings) {
1224
+ http.setRequestHeader("accept-language", window.localeSettings);
1225
+ }
1145
1226
  http.send();
1146
1227
  } catch (ex) {
1147
1228
  reject(ex);
@@ -1175,6 +1256,9 @@ WebAuth.prototype.registerDeduplication = function (options) {
1175
1256
  };
1176
1257
  http.open("POST", _serviceURL, true);
1177
1258
  http.setRequestHeader("Content-type", "application/json");
1259
+ if (window.localeSettings) {
1260
+ http.setRequestHeader("accept-language", window.localeSettings);
1261
+ }
1178
1262
  http.send();
1179
1263
  } catch (ex) {
1180
1264
  reject(ex);
@@ -1277,6 +1361,9 @@ WebAuth.prototype.updateProfile = function (options, access_token, sub) {
1277
1361
  http.open("PUT", _serviceURL, true);
1278
1362
  http.setRequestHeader("Content-type", "application/json");
1279
1363
  http.setRequestHeader("access_token", access_token);
1364
+ if (window.localeSettings) {
1365
+ http.setRequestHeader("accept-language", window.localeSettings);
1366
+ }
1280
1367
  http.send(JSON.stringify(options));
1281
1368
  } catch (ex) {
1282
1369
  throw new CustomException(ex, 417);
@@ -1308,6 +1395,9 @@ WebAuth.prototype.getUnreviewedDevices = function (access_token, sub) {
1308
1395
  http.open("GET", _serviceURL, true);
1309
1396
  http.setRequestHeader("Content-type", "application/json");
1310
1397
  http.setRequestHeader("access_token", access_token);
1398
+ if (window.localeSettings) {
1399
+ http.setRequestHeader("accept-language", window.localeSettings);
1400
+ }
1311
1401
  http.send();
1312
1402
  } catch (ex) {
1313
1403
  throw new CustomException(ex, 417);
@@ -1333,6 +1423,9 @@ WebAuth.prototype.getReviewedDevices = function (access_token, sub) {
1333
1423
  http.open("GET", _serviceURL, true);
1334
1424
  http.setRequestHeader("Content-type", "application/json");
1335
1425
  http.setRequestHeader("access_token", access_token);
1426
+ if (window.localeSettings) {
1427
+ http.setRequestHeader("accept-language", window.localeSettings);
1428
+ }
1336
1429
  http.send();
1337
1430
  } catch (ex) {
1338
1431
  throw new CustomException(ex, 417);
@@ -1358,6 +1451,9 @@ WebAuth.prototype.reviewDevice = function (options, access_token, sub) {
1358
1451
  http.open("PUT", _serviceURL, true);
1359
1452
  http.setRequestHeader("Content-type", "application/json");
1360
1453
  http.setRequestHeader("access_token", access_token);
1454
+ if (window.localeSettings) {
1455
+ http.setRequestHeader("accept-language", window.localeSettings);
1456
+ }
1361
1457
  http.send(JSON.stringify(options));
1362
1458
  } catch (ex) {
1363
1459
  throw new CustomException(ex, 417);
@@ -1389,6 +1485,9 @@ WebAuth.prototype.viewAcceptedConsent = function (options, access_token) {
1389
1485
  http.open("GET", _serviceURL, true);
1390
1486
  http.setRequestHeader("Content-type", "application/json");
1391
1487
  http.setRequestHeader("access_token", access_token);
1488
+ if (window.localeSettings) {
1489
+ http.setRequestHeader("accept-language", window.localeSettings);
1490
+ }
1392
1491
  http.send();
1393
1492
  } catch (ex) {
1394
1493
  throw new CustomException(ex, 417);
@@ -1591,6 +1690,9 @@ WebAuth.prototype.authenticateFaceVerification = function (options) {
1591
1690
  };
1592
1691
  http.open("POST", _serviceURL, true);
1593
1692
  http.setRequestHeader("Content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
1693
+ if (window.localeSettings) {
1694
+ http.setRequestHeader("accept-language", window.localeSettings);
1695
+ }
1594
1696
  http.send(JSON.stringify(options));
1595
1697
  } catch (ex) {
1596
1698
  reject(ex);
@@ -1627,6 +1729,9 @@ WebAuth.prototype.getMissingFieldsLogin = function (trackId) {
1627
1729
  };
1628
1730
  http.open("GET", _serviceURL, true);
1629
1731
  http.setRequestHeader("Content-type", "application/json");
1732
+ if (window.localeSettings) {
1733
+ http.setRequestHeader("accept-language", window.localeSettings);
1734
+ }
1630
1735
  http.send();
1631
1736
  } catch (ex) {
1632
1737
  reject(ex);
@@ -1655,6 +1760,8 @@ WebAuth.prototype.progressiveRegistration = function (options, headers) {
1655
1760
  http.setRequestHeader("trackId", headers.trackId);
1656
1761
  if (headers.acceptlanguage) {
1657
1762
  http.setRequestHeader("accept-language", headers.acceptlanguage);
1763
+ } else if (window.localeSettings) {
1764
+ http.setRequestHeader("accept-language", window.localeSettings);
1658
1765
  }
1659
1766
  http.send(JSON.stringify(options));
1660
1767
  } catch (ex) {
@@ -1691,4 +1798,8 @@ WebAuth.prototype.userCheckExists = function (options) {
1691
1798
  return createPostPromise(options, _serviceURL, undefined);
1692
1799
  };
1693
1800
 
1801
+ WebAuth.prototype.setAcceptLanguageHeader = function(acceptLanguage) {
1802
+ window.localeSettings = acceptLanguage;
1803
+ }
1804
+
1694
1805
  module.exports = WebAuth;
@@ -79,6 +79,8 @@ declare class WebAuth {
79
79
  getScopeConsentVersionDetailsV2(options: any): Promise<any>;
80
80
  acceptScopeConsent(options: any): Promise<any>;
81
81
  scopeConsentContinue(options: any): void;
82
+ acceptClaimConsent(options: any): Promise<any>;
83
+ claimConsentContinue(options: any): void;
82
84
  getDeduplicationDetails(options: any): Promise<any>;
83
85
  deduplicationLogin(options: any): void;
84
86
  registerDeduplication(options: any): Promise<any>;
@@ -127,4 +129,5 @@ declare class WebAuth {
127
129
  progressiveRegistration(options: any, headers: any): Promise<any>;
128
130
  loginAfterRegister(options: any): void;
129
131
  userCheckExists(options: any): Promise<any>;
132
+ setAcceptLanguageHeader(acceptLanguage: any): void;
130
133
  }