@axa-fr/react-oidc 5.14.0 → 6.0.0-alpha2

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.
Files changed (66) hide show
  1. package/dist/OidcProvider.d.ts +1 -0
  2. package/dist/OidcProvider.d.ts.map +1 -1
  3. package/dist/OidcProvider.js +13 -5
  4. package/dist/OidcProvider.js.map +1 -1
  5. package/dist/OidcServiceWorker.js +29 -1
  6. package/dist/OidcTrustedDomains.js +7 -4
  7. package/dist/ReactOidc.d.ts.map +1 -1
  8. package/dist/ReactOidc.js +29 -7
  9. package/dist/ReactOidc.js.map +1 -1
  10. package/dist/core/default-component/ServiceWorkerInstall.component.d.ts.map +1 -1
  11. package/dist/core/default-component/ServiceWorkerInstall.component.js +21 -9
  12. package/dist/core/default-component/ServiceWorkerInstall.component.js.map +1 -1
  13. package/dist/core/default-component/SilentCallback.component.d.ts.map +1 -1
  14. package/dist/core/default-component/SilentCallback.component.js +23 -15
  15. package/dist/core/default-component/SilentCallback.component.js.map +1 -1
  16. package/dist/core/default-component/SilentSignin.component.d.ts +4 -0
  17. package/dist/core/default-component/SilentSignin.component.d.ts.map +1 -0
  18. package/dist/core/default-component/SilentSignin.component.js +58 -0
  19. package/dist/core/default-component/SilentSignin.component.js.map +1 -0
  20. package/dist/core/routes/OidcRoutes.d.ts +1 -0
  21. package/dist/core/routes/OidcRoutes.d.ts.map +1 -1
  22. package/dist/core/routes/OidcRoutes.js +8 -2
  23. package/dist/core/routes/OidcRoutes.js.map +1 -1
  24. package/dist/vanilla/checkSessionIFrame.d.ts +17 -0
  25. package/dist/vanilla/checkSessionIFrame.d.ts.map +1 -0
  26. package/dist/vanilla/checkSessionIFrame.js +78 -0
  27. package/dist/vanilla/checkSessionIFrame.js.map +1 -0
  28. package/dist/vanilla/initSession.d.ts +3 -1
  29. package/dist/vanilla/initSession.d.ts.map +1 -1
  30. package/dist/vanilla/initSession.js +20 -11
  31. package/dist/vanilla/initSession.js.map +1 -1
  32. package/dist/vanilla/initWorker.d.ts +4 -0
  33. package/dist/vanilla/initWorker.d.ts.map +1 -1
  34. package/dist/vanilla/initWorker.js +29 -3
  35. package/dist/vanilla/initWorker.js.map +1 -1
  36. package/dist/vanilla/oidc.d.ts +24 -7
  37. package/dist/vanilla/oidc.d.ts.map +1 -1
  38. package/dist/vanilla/oidc.js +526 -241
  39. package/dist/vanilla/oidc.js.map +1 -1
  40. package/dist/vanilla/route-utils.d.ts +13 -0
  41. package/dist/vanilla/route-utils.d.ts.map +1 -0
  42. package/dist/vanilla/route-utils.js +65 -0
  43. package/dist/vanilla/route-utils.js.map +1 -0
  44. package/package.json +1 -1
  45. package/src/App.tsx +1 -1
  46. package/src/MultiAuth.tsx +2 -2
  47. package/src/configurations.ts +6 -2
  48. package/src/oidc/OidcProvider.tsx +11 -0
  49. package/src/oidc/ReactOidc.tsx +32 -8
  50. package/src/oidc/core/default-component/ServiceWorkerInstall.component.tsx +15 -3
  51. package/src/oidc/core/default-component/SilentCallback.component.tsx +10 -15
  52. package/src/oidc/core/default-component/SilentSignin.component.tsx +35 -0
  53. package/src/oidc/core/routes/OidcRoutes.tsx +10 -1
  54. package/src/oidc/vanilla/OidcServiceWorker.js +29 -1
  55. package/src/oidc/vanilla/OidcTrustedDomains.js +7 -4
  56. package/src/oidc/vanilla/checkSessionIFrame.ts +82 -0
  57. package/src/oidc/vanilla/initSession.ts +23 -11
  58. package/src/oidc/vanilla/initWorker.ts +19 -2
  59. package/src/oidc/vanilla/oidc.ts +410 -152
  60. package/src/oidc/{core/routes → vanilla}/route-utils.spec.ts +0 -0
  61. package/src/oidc/vanilla/route-utils.ts +76 -0
  62. package/dist/core/routes/route-utils.d.ts +0 -2
  63. package/dist/core/routes/route-utils.d.ts.map +0 -1
  64. package/dist/core/routes/route-utils.js +0 -32
  65. package/dist/core/routes/route-utils.js.map +0 -1
  66. package/src/oidc/core/routes/route-utils.ts +0 -34
@@ -0,0 +1,76 @@
1
+ export const getLocation = (href: string) => {
2
+ const match = href.match(
3
+ // eslint-disable-next-line no-useless-escape
4
+ /^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
5
+ );
6
+
7
+ let search = match[6];
8
+ let hash = match[7];
9
+
10
+ if (hash) {
11
+ const splits = hash.split("?");
12
+ if(splits.length ==2){
13
+ hash = splits[0];
14
+ search = splits[1];
15
+ }
16
+ }
17
+
18
+ if(search){
19
+ search = search.slice(1);
20
+ }
21
+
22
+ return (
23
+ match && {
24
+ href,
25
+ protocol: match[1],
26
+ host: match[2],
27
+ hostname: match[3],
28
+ port: match[4],
29
+ path: match[5],
30
+ search,
31
+ hash,
32
+ }
33
+ );
34
+ };
35
+
36
+ export const getPath = (href: string) => {
37
+ const location = getLocation(href);
38
+ let { path } = location;
39
+
40
+ if(path.endsWith('/')){
41
+ path = path.slice(0, -1);
42
+ }
43
+ let { hash } = location;
44
+
45
+ if(hash === "#_=_"){
46
+ hash = "";
47
+ }
48
+
49
+ if (hash) {
50
+ path += hash;
51
+ }
52
+
53
+ return path;
54
+ };
55
+
56
+ export const getParseQueryStringFromLocation=(href: string) => {
57
+ const location = getLocation(href);
58
+ let { search } = location;
59
+
60
+ return parseQueryString(search);
61
+ }
62
+
63
+ const parseQueryString = (queryString:string) => {
64
+ let params:any = {}, queries, temp, i, l;
65
+
66
+ // Split into key/value pairs
67
+ queries = queryString.split("&");
68
+
69
+ // Convert the array of strings into an object
70
+ for (i = 0, l = queries.length; i < l; i++) {
71
+ temp = queries[i].split('=');
72
+ params[temp[0]] = temp[1];
73
+ }
74
+
75
+ return params;
76
+ };
@@ -1,2 +0,0 @@
1
- export declare const getPath: (href: string) => string;
2
- //# sourceMappingURL=route-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-utils.d.ts","sourceRoot":"","sources":["../../../src/oidc/core/routes/route-utils.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,OAAO,SAAU,MAAM,WAcnC,CAAC"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPath = void 0;
4
- var getLocation = function (href) {
5
- var match = href.match(
6
- // eslint-disable-next-line no-useless-escape
7
- /^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);
8
- return (match && {
9
- href: href,
10
- protocol: match[1],
11
- host: match[2],
12
- hostname: match[3],
13
- port: match[4],
14
- path: match[5],
15
- search: match[6],
16
- hash: match[7],
17
- });
18
- };
19
- var getPath = function (href) {
20
- var location = getLocation(href);
21
- var path = location.path;
22
- if (path.endsWith('/')) {
23
- path = path.slice(0, -1);
24
- }
25
- var hash = location.hash;
26
- if (hash) {
27
- path += hash.split("?")[0];
28
- }
29
- return path;
30
- };
31
- exports.getPath = getPath;
32
- //# sourceMappingURL=route-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-utils.js","sourceRoot":"","sources":["../../../src/oidc/core/routes/route-utils.ts"],"names":[],"mappings":";;;AAAA,IAAM,WAAW,GAAG,UAAC,IAAY;IAC/B,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK;IACtB,6CAA6C;IAC7C,+EAA+E,CAChF,CAAC;IACF,OAAO,CACL,KAAK,IAAI;QACP,IAAI,MAAA;QACJ,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAClB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAClB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAChB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;KACf,CACF,CAAC;AACJ,CAAC,CAAC;AAEK,IAAM,OAAO,GAAG,UAAC,IAAY;IAClC,IAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAA,IAAI,GAAK,QAAQ,KAAb,CAAc;IAExB,IAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;QAClB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC5B;IACO,IAAA,IAAI,GAAK,QAAQ,KAAb,CAAc;IAE1B,IAAI,IAAI,EAAE;QACR,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5B;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB"}
@@ -1,34 +0,0 @@
1
- const getLocation = (href: string) => {
2
- const match = href.match(
3
- // eslint-disable-next-line no-useless-escape
4
- /^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
5
- );
6
- return (
7
- match && {
8
- href,
9
- protocol: match[1],
10
- host: match[2],
11
- hostname: match[3],
12
- port: match[4],
13
- path: match[5],
14
- search: match[6],
15
- hash: match[7],
16
- }
17
- );
18
- };
19
-
20
- export const getPath = (href: string) => {
21
- const location = getLocation(href);
22
- let { path } = location;
23
-
24
- if(path.endsWith('/')){
25
- path = path.slice(0, -1);
26
- }
27
- const { hash } = location;
28
-
29
- if (hash) {
30
- path += hash.split("?")[0];
31
- }
32
-
33
- return path;
34
- };