@multiplatform.one/keycloak 0.3.32 → 0.7.0

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 (154) hide show
  1. package/lib/index.js +34 -0
  2. package/package.json +32 -48
  3. package/src/@types/coreJsPure.d.ts +8 -8
  4. package/src/hooks/useKeycloak/index.ts +3 -4
  5. package/src/hooks/useKeycloak/useKeycloak.native.ts +3 -3
  6. package/src/hooks/useKeycloak/useKeycloak.ts +71 -16
  7. package/dist/esm/Authenticated.mjs +0 -40
  8. package/dist/esm/Authenticated.mjs.map +0 -7
  9. package/dist/esm/authConfig.mjs +0 -12
  10. package/dist/esm/authConfig.mjs.map +0 -7
  11. package/dist/esm/hooks/index.mjs +0 -7
  12. package/dist/esm/hooks/index.mjs.map +0 -7
  13. package/dist/esm/hooks/useAuthConfig.mjs +0 -9
  14. package/dist/esm/hooks/useAuthConfig.mjs.map +0 -7
  15. package/dist/esm/hooks/useCurrentRouteName/index.mjs +0 -17
  16. package/dist/esm/hooks/useCurrentRouteName/index.mjs.map +0 -7
  17. package/dist/esm/hooks/useCurrentRouteName/index.native.mjs +0 -12
  18. package/dist/esm/hooks/useCurrentRouteName/index.native.mjs.map +0 -7
  19. package/dist/esm/hooks/useKeycloak/index.mjs +0 -2
  20. package/dist/esm/hooks/useKeycloak/index.mjs.map +0 -7
  21. package/dist/esm/hooks/useKeycloak/useKeycloak.mjs +0 -91
  22. package/dist/esm/hooks/useKeycloak/useKeycloak.mjs.map +0 -7
  23. package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs +0 -108
  24. package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs.map +0 -7
  25. package/dist/esm/hooks/useLogin.mjs +0 -35
  26. package/dist/esm/hooks/useLogin.mjs.map +0 -7
  27. package/dist/esm/hooks/useTokensFromQuery/index.mjs +0 -12
  28. package/dist/esm/hooks/useTokensFromQuery/index.mjs.map +0 -7
  29. package/dist/esm/hooks/useTokensFromQuery/index.native.mjs +0 -7
  30. package/dist/esm/hooks/useTokensFromQuery/index.native.mjs.map +0 -7
  31. package/dist/esm/hooks/useTokensFromState.mjs +0 -10
  32. package/dist/esm/hooks/useTokensFromState.mjs.map +0 -7
  33. package/dist/esm/index.mjs +0 -5
  34. package/dist/esm/index.mjs.map +0 -7
  35. package/dist/esm/provider/afterAuth.mjs +0 -43
  36. package/dist/esm/provider/afterAuth.mjs.map +0 -7
  37. package/dist/esm/provider/index.mjs +0 -136
  38. package/dist/esm/provider/index.mjs.map +0 -7
  39. package/dist/esm/provider/keycloakProvider.mjs +0 -338
  40. package/dist/esm/provider/keycloakProvider.mjs.map +0 -7
  41. package/dist/esm/provider/keycloakProvider.native.mjs +0 -69
  42. package/dist/esm/provider/keycloakProvider.native.mjs.map +0 -7
  43. package/dist/esm/state/index.mjs +0 -16
  44. package/dist/esm/state/index.mjs.map +0 -7
  45. package/dist/esm/types.mjs +0 -5
  46. package/dist/esm/types.mjs.map +0 -7
  47. package/dist/esm/util.mjs +0 -26
  48. package/dist/esm/util.mjs.map +0 -7
  49. package/dist/jsx/Authenticated.mjs +0 -35
  50. package/dist/jsx/Authenticated.mjs.map +0 -7
  51. package/dist/jsx/authConfig.mjs +0 -12
  52. package/dist/jsx/authConfig.mjs.map +0 -7
  53. package/dist/jsx/hooks/index.mjs +0 -7
  54. package/dist/jsx/hooks/index.mjs.map +0 -7
  55. package/dist/jsx/hooks/useAuthConfig.mjs +0 -9
  56. package/dist/jsx/hooks/useAuthConfig.mjs.map +0 -7
  57. package/dist/jsx/hooks/useCurrentRouteName/index.mjs +0 -17
  58. package/dist/jsx/hooks/useCurrentRouteName/index.mjs.map +0 -7
  59. package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs +0 -12
  60. package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs.map +0 -7
  61. package/dist/jsx/hooks/useKeycloak/index.mjs +0 -2
  62. package/dist/jsx/hooks/useKeycloak/index.mjs.map +0 -7
  63. package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs +0 -32
  64. package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs.map +0 -7
  65. package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs +0 -58
  66. package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs.map +0 -7
  67. package/dist/jsx/hooks/useLogin.mjs +0 -33
  68. package/dist/jsx/hooks/useLogin.mjs.map +0 -7
  69. package/dist/jsx/hooks/useTokensFromQuery/index.mjs +0 -10
  70. package/dist/jsx/hooks/useTokensFromQuery/index.mjs.map +0 -7
  71. package/dist/jsx/hooks/useTokensFromQuery/index.native.mjs +0 -5
  72. package/dist/jsx/hooks/useTokensFromQuery/index.native.mjs.map +0 -7
  73. package/dist/jsx/hooks/useTokensFromState.mjs +0 -10
  74. package/dist/jsx/hooks/useTokensFromState.mjs.map +0 -7
  75. package/dist/jsx/index.mjs +0 -5
  76. package/dist/jsx/index.mjs.map +0 -7
  77. package/dist/jsx/provider/afterAuth.mjs +0 -42
  78. package/dist/jsx/provider/afterAuth.mjs.map +0 -7
  79. package/dist/jsx/provider/index.mjs +0 -61
  80. package/dist/jsx/provider/index.mjs.map +0 -7
  81. package/dist/jsx/provider/keycloakProvider.mjs +0 -247
  82. package/dist/jsx/provider/keycloakProvider.mjs.map +0 -7
  83. package/dist/jsx/provider/keycloakProvider.native.mjs +0 -14
  84. package/dist/jsx/provider/keycloakProvider.native.mjs.map +0 -7
  85. package/dist/jsx/state/index.mjs +0 -19
  86. package/dist/jsx/state/index.mjs.map +0 -7
  87. package/dist/jsx/types.mjs +0 -5
  88. package/dist/jsx/types.mjs.map +0 -7
  89. package/dist/jsx/util.mjs +0 -25
  90. package/dist/jsx/util.mjs.map +0 -7
  91. package/dist/lib/Authenticated.d.ts +0 -32
  92. package/dist/lib/Authenticated.js +0 -75
  93. package/dist/lib/Authenticated.js.map +0 -7
  94. package/dist/lib/authConfig.d.ts +0 -34
  95. package/dist/lib/authConfig.js +0 -37
  96. package/dist/lib/authConfig.js.map +0 -7
  97. package/dist/lib/hooks/index.d.ts +0 -29
  98. package/dist/lib/hooks/index.js +0 -33
  99. package/dist/lib/hooks/index.js.map +0 -7
  100. package/dist/lib/hooks/useAuthConfig.d.ts +0 -24
  101. package/dist/lib/hooks/useAuthConfig.js +0 -33
  102. package/dist/lib/hooks/useAuthConfig.js.map +0 -7
  103. package/dist/lib/hooks/useCurrentRouteName/index.d.ts +0 -24
  104. package/dist/lib/hooks/useCurrentRouteName/index.js +0 -41
  105. package/dist/lib/hooks/useCurrentRouteName/index.js.map +0 -7
  106. package/dist/lib/hooks/useCurrentRouteName/index.native.d.ts +0 -24
  107. package/dist/lib/hooks/useCurrentRouteName/index.native.js +0 -36
  108. package/dist/lib/hooks/useCurrentRouteName/index.native.js.map +0 -7
  109. package/dist/lib/hooks/useKeycloak/index.d.ts +0 -48
  110. package/dist/lib/hooks/useKeycloak/index.js +0 -23
  111. package/dist/lib/hooks/useKeycloak/index.js.map +0 -7
  112. package/dist/lib/hooks/useKeycloak/useKeycloak.d.ts +0 -25
  113. package/dist/lib/hooks/useKeycloak/useKeycloak.js +0 -72
  114. package/dist/lib/hooks/useKeycloak/useKeycloak.js.map +0 -7
  115. package/dist/lib/hooks/useKeycloak/useKeycloak.native.d.ts +0 -40
  116. package/dist/lib/hooks/useKeycloak/useKeycloak.native.js +0 -93
  117. package/dist/lib/hooks/useKeycloak/useKeycloak.native.js.map +0 -7
  118. package/dist/lib/hooks/useLogin.d.ts +0 -24
  119. package/dist/lib/hooks/useLogin.js +0 -57
  120. package/dist/lib/hooks/useLogin.js.map +0 -7
  121. package/dist/lib/hooks/useTokensFromQuery/index.d.ts +0 -24
  122. package/dist/lib/hooks/useTokensFromQuery/index.js +0 -34
  123. package/dist/lib/hooks/useTokensFromQuery/index.js.map +0 -7
  124. package/dist/lib/hooks/useTokensFromQuery/index.native.d.ts +0 -24
  125. package/dist/lib/hooks/useTokensFromQuery/index.native.js +0 -29
  126. package/dist/lib/hooks/useTokensFromQuery/index.native.js.map +0 -7
  127. package/dist/lib/hooks/useTokensFromState.d.ts +0 -24
  128. package/dist/lib/hooks/useTokensFromState.js +0 -34
  129. package/dist/lib/hooks/useTokensFromState.js.map +0 -7
  130. package/dist/lib/index.d.ts +0 -27
  131. package/dist/lib/index.js +0 -29
  132. package/dist/lib/index.js.map +0 -7
  133. package/dist/lib/provider/afterAuth.d.ts +0 -28
  134. package/dist/lib/provider/afterAuth.js +0 -67
  135. package/dist/lib/provider/afterAuth.js.map +0 -7
  136. package/dist/lib/provider/index.d.ts +0 -38
  137. package/dist/lib/provider/index.js +0 -131
  138. package/dist/lib/provider/index.js.map +0 -7
  139. package/dist/lib/provider/keycloakProvider.d.ts +0 -41
  140. package/dist/lib/provider/keycloakProvider.js +0 -305
  141. package/dist/lib/provider/keycloakProvider.js.map +0 -7
  142. package/dist/lib/provider/keycloakProvider.native.d.ts +0 -26
  143. package/dist/lib/provider/keycloakProvider.native.js +0 -55
  144. package/dist/lib/provider/keycloakProvider.native.js.map +0 -7
  145. package/dist/lib/state/index.d.ts +0 -24
  146. package/dist/lib/state/index.js +0 -43
  147. package/dist/lib/state/index.js.map +0 -7
  148. package/dist/lib/tsconfig.build.tsbuildinfo +0 -1
  149. package/dist/lib/types.d.ts +0 -39
  150. package/dist/lib/types.js +0 -25
  151. package/dist/lib/types.js.map +0 -7
  152. package/dist/lib/util.d.ts +0 -25
  153. package/dist/lib/util.js +0 -51
  154. package/dist/lib/util.js.map +0 -7
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useLogin_exports = {};
20
- __export(useLogin_exports, {
21
- useLogin: () => useLogin
22
- });
23
- module.exports = __toCommonJS(useLogin_exports);
24
- var import_multiplatform = require("multiplatform.one");
25
- var import_useAuthConfig = require("./useAuthConfig");
26
- var import_useCurrentRouteName = require("./useCurrentRouteName");
27
- var import_useKeycloak = require("./useKeycloak/useKeycloak");
28
- var import_router = require("solito/router");
29
- function useLogin(loginRoute) {
30
- if (import_multiplatform.MultiPlatform.isStorybook)
31
- return () => null;
32
- const keycloak = (0, import_useKeycloak.useKeycloak)();
33
- const authConfig = (0, import_useAuthConfig.useAuthConfig)();
34
- const currentRouteName = (0, import_useCurrentRouteName.useCurrentRouteName)();
35
- const router = (0, import_router.useRouter)();
36
- return () => {
37
- if (!loginRoute)
38
- loginRoute = authConfig.loginRoute;
39
- if (!loginRoute) {
40
- keycloak.login();
41
- return;
42
- }
43
- const url = new URL("x://".concat(loginRoute));
44
- const searchParams = new URLSearchParams(url.search);
45
- if (currentRouteName)
46
- searchParams.append("backTo", currentRouteName);
47
- let query = searchParams.toString();
48
- if (query.length)
49
- query = "?".concat(query);
50
- router.push("".concat(url.pathname.substring(2)).concat(query));
51
- };
52
- }
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- useLogin
56
- });
57
- //# sourceMappingURL=useLogin.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useLogin.ts"],
4
- "sourcesContent": ["/**\n * File: /src/hooks/useLogin.ts\n * Project: app\n * File Created: 08-11-2022 08:49:14\n * Author: Clay Risser\n * -----\n * Last Modified: 25-04-2023 23:09:10\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from './useAuthConfig';\nimport { useCurrentRouteName } from './useCurrentRouteName';\nimport { useKeycloak } from './useKeycloak/useKeycloak';\nimport { useRouter } from 'solito/router';\n\nexport function useLogin(loginRoute?: string) {\n if (MultiPlatform.isStorybook) return () => null;\n const keycloak = useKeycloak();\n const authConfig = useAuthConfig();\n const currentRouteName = useCurrentRouteName();\n const router = useRouter();\n return () => {\n if (!loginRoute) loginRoute = authConfig.loginRoute;\n if (!loginRoute) {\n keycloak.login();\n return;\n }\n const url = new URL(`x://${loginRoute}`);\n const searchParams = new URLSearchParams(url.search);\n if (currentRouteName) searchParams.append('backTo', currentRouteName);\n let query = searchParams.toString();\n if (query.length) query = `?${query}`;\n router.push(`${url.pathname.substring(2)}${query}`);\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,2BAA8B;AAC9B,2BAA8B;AAC9B,iCAAoC;AACpC,yBAA4B;AAC5B,oBAA0B;AAEnB,SAAS,SAAS,YAAqB;AAC5C,MAAI,mCAAc;AAAa,WAAO,MAAM;AAC5C,QAAM,eAAW,gCAAY;AAC7B,QAAM,iBAAa,oCAAc;AACjC,QAAM,uBAAmB,gDAAoB;AAC7C,QAAM,aAAS,yBAAU;AACzB,SAAO,MAAM;AACX,QAAI,CAAC;AAAY,mBAAa,WAAW;AACzC,QAAI,CAAC,YAAY;AACf,eAAS,MAAM;AACf;AAAA,IACF;AACA,UAAM,MAAM,IAAI,IAAI,OAAO,kBAAY;AACvC,UAAM,eAAe,IAAI,gBAAgB,IAAI,MAAM;AACnD,QAAI;AAAkB,mBAAa,OAAO,UAAU,gBAAgB;AACpE,QAAI,QAAQ,aAAa,SAAS;AAClC,QAAI,MAAM;AAAQ,cAAQ,IAAI;AAC9B,WAAO,KAAK,GAAG,WAAI,SAAS,UAAU,CAAC,GAAI,aAAO;AAAA,EACpD;AACF;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * File: /src/hooks/useTokensFromQuery/index.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 15-05-2023 01:54:44
5
- * Author: Clay Risser
6
- * -----
7
- * Last Modified: 16-05-2023 07:40:41
8
- * Modified By: Clay Risser
9
- * -----
10
- * Risser Labs LLC (c) Copyright 2022 - 2023
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- export declare function useTokensFromQuery(): boolean;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useTokensFromQuery_exports = {};
20
- __export(useTokensFromQuery_exports, {
21
- useTokensFromQuery: () => useTokensFromQuery
22
- });
23
- module.exports = __toCommonJS(useTokensFromQuery_exports);
24
- var import_multiplatform = require("multiplatform.one");
25
- var import_router = require("next/router");
26
- function useTokensFromQuery() {
27
- const { query } = import_multiplatform.MultiPlatform.isNext ? (0, import_router.useRouter)() : { query: {} };
28
- return "idToken" in query || "token" in query || "refreshToken" in query;
29
- }
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- useTokensFromQuery
33
- });
34
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/hooks/useTokensFromQuery/index.ts"],
4
- "sourcesContent": ["/**\n * File: /src/hooks/useTokensFromQuery/index.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 15-05-2023 01:54:44\n * Author: Clay Risser\n * -----\n * Last Modified: 16-05-2023 07:40:41\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022 - 2023\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useRouter } from 'next/router';\n\nexport function useTokensFromQuery() {\n const { query } = MultiPlatform.isNext ? useRouter() : { query: {} };\n return 'idToken' in query || 'token' in query || 'refreshToken' in query;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,2BAA8B;AAC9B,oBAA0B;AAEnB,SAAS,qBAAqB;AACnC,QAAM,EAAE,MAAM,IAAI,mCAAc,aAAS,yBAAU,IAAI,EAAE,OAAO,CAAC,EAAE;AACnE,SAAO,aAAa,SAAS,WAAW,SAAS,kBAAkB;AACrE;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * File: /src/hooks/useTokensFromQuery/index.native.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 15-05-2023 01:54:48
5
- * Author: Clay Risser
6
- * -----
7
- * Last Modified: 16-05-2023 07:40:46
8
- * Modified By: Clay Risser
9
- * -----
10
- * Risser Labs LLC (c) Copyright 2022 - 2023
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- export declare const useTokensFromQuery: () => boolean;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var index_native_exports = {};
20
- __export(index_native_exports, {
21
- useTokensFromQuery: () => useTokensFromQuery
22
- });
23
- module.exports = __toCommonJS(index_native_exports);
24
- const useTokensFromQuery = () => false;
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- useTokensFromQuery
28
- });
29
- //# sourceMappingURL=index.native.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/hooks/useTokensFromQuery/index.native.ts"],
4
- "sourcesContent": ["/**\n * File: /src/hooks/useTokensFromQuery/index.native.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 15-05-2023 01:54:48\n * Author: Clay Risser\n * -----\n * Last Modified: 16-05-2023 07:40:46\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022 - 2023\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const useTokensFromQuery = () => false;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBO,MAAM,qBAAqB,MAAM;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * File: /src/hooks/useTokensFromState.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 16-05-2023 06:29:02
5
- * Author: Clay Risser
6
- * -----
7
- * Last Modified: 16-05-2023 07:40:36
8
- * Modified By: Clay Risser
9
- * -----
10
- * Risser Labs LLC (c) Copyright 2022 - 2023
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- export declare function useTokensFromState(): boolean;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useTokensFromState_exports = {};
20
- __export(useTokensFromState_exports, {
21
- useTokensFromState: () => useTokensFromState
22
- });
23
- module.exports = __toCommonJS(useTokensFromState_exports);
24
- var import_state = require("../state");
25
- var import_util = require("../util");
26
- function useTokensFromState() {
27
- const authState = (0, import_state.useAuthState)();
28
- return !!(0, import_util.validToken)(authState.token, authState.refreshToken);
29
- }
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- useTokensFromState
33
- });
34
- //# sourceMappingURL=useTokensFromState.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useTokensFromState.ts"],
4
- "sourcesContent": ["/**\n * File: /src/hooks/useTokensFromState.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 16-05-2023 06:29:02\n * Author: Clay Risser\n * -----\n * Last Modified: 16-05-2023 07:40:36\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022 - 2023\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useAuthState } from '../state';\nimport { validToken } from '../util';\n\nexport function useTokensFromState() {\n const authState = useAuthState();\n return !!validToken(authState.token, authState.refreshToken);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,mBAA6B;AAC7B,kBAA2B;AAEpB,SAAS,qBAAqB;AACnC,QAAM,gBAAY,2BAAa;AAC/B,SAAO,CAAC,KAAC,wBAAW,UAAU,OAAO,UAAU,YAAY;AAC7D;",
6
- "names": []
7
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * File: /src/index.ts
3
- * Project: @multiplatform.one/keycloak
4
- * File Created: 25-11-2022 09:51:55
5
- * Author: Clay Risser
6
- * -----
7
- * Last Modified: 25-11-2022 09:52:06
8
- * Modified By: Clay Risser
9
- * -----
10
- * Risser Labs LLC (c) Copyright 2022
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- export * from './Authenticated';
25
- export * from './authConfig';
26
- export * from './hooks';
27
- export * from './provider';
package/dist/lib/index.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var src_exports = {};
17
- module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./Authenticated"), module.exports);
19
- __reExport(src_exports, require("./authConfig"), module.exports);
20
- __reExport(src_exports, require("./hooks"), module.exports);
21
- __reExport(src_exports, require("./provider"), module.exports);
22
- // Annotate the CommonJS export names for ESM import in node:
23
- 0 && (module.exports = {
24
- ...require("./Authenticated"),
25
- ...require("./authConfig"),
26
- ...require("./hooks"),
27
- ...require("./provider")
28
- });
29
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["/**\n * File: /src/index.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 25-11-2022 09:51:55\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 09:52:06\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './Authenticated';\nexport * from './authConfig';\nexport * from './hooks';\nexport * from './provider';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAwBA,wBAAc,4BAxBd;AAyBA,wBAAc,yBAzBd;AA0BA,wBAAc,oBA1Bd;AA2BA,wBAAc,uBA3Bd;",
6
- "names": []
7
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * File: /auth/provider/afterAuth.tsx
3
- * Project: app
4
- * File Created: 22-11-2022 17:49:58
5
- * Author: Clay Risser
6
- * -----
7
- * Last Modified: 22-11-2022 18:00:39
8
- * Modified By: Clay Risser
9
- * -----
10
- * Risser Labs LLC (c) Copyright 2021 - 2022
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- import type { FC, ReactNode } from 'react';
25
- export interface AfterAuthProps {
26
- children: ReactNode;
27
- }
28
- export declare const AfterAuth: FC<AfterAuthProps>;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var afterAuth_exports = {};
20
- __export(afterAuth_exports, {
21
- AfterAuth: () => AfterAuth
22
- });
23
- module.exports = __toCommonJS(afterAuth_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_react = require("react");
26
- var import_useAuthConfig = require("../hooks/useAuthConfig");
27
- var import_state = require("../state");
28
- var import_hooks = require("../hooks");
29
- const logger = console;
30
- const AfterAuth = ({ children }) => {
31
- const authConfig = (0, import_useAuthConfig.useAuthConfig)();
32
- const authState = (0, import_state.useAuthState)();
33
- const { token, refreshToken, authenticated, idToken } = (0, import_hooks.useKeycloak)();
34
- (0, import_react.useEffect)(() => {
35
- if (!authenticated)
36
- return;
37
- if (authConfig.persist && token) {
38
- authState.setToken(token);
39
- if (idToken)
40
- authState.setIdToken(idToken);
41
- if (authConfig.ensureFreshness && refreshToken)
42
- authState.setRefreshToken(refreshToken);
43
- }
44
- }, [token, refreshToken, idToken]);
45
- (0, import_react.useEffect)(() => {
46
- if (authConfig.debug && authState.token)
47
- logger.debug("token", authState.token);
48
- }, [authState.token]);
49
- (0, import_react.useEffect)(() => {
50
- if (authConfig.debug && authState.idToken)
51
- logger.debug("idToken", authState.idToken);
52
- }, [authState.idToken]);
53
- (0, import_react.useEffect)(() => {
54
- if (authConfig.debug && authState.refreshToken)
55
- logger.debug("refreshToken", authState.refreshToken);
56
- }, [authState.refreshToken]);
57
- (0, import_react.useEffect)(() => {
58
- if (authConfig.debug)
59
- logger.debug("authenticated", authenticated);
60
- }, [authenticated]);
61
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
62
- };
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- AfterAuth
66
- });
67
- //# sourceMappingURL=afterAuth.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/provider/afterAuth.tsx"],
4
- "sourcesContent": ["/**\n * File: /auth/provider/afterAuth.tsx\n * Project: app\n * File Created: 22-11-2022 17:49:58\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:00:39\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\nimport type { FC, ReactNode } from 'react';\nimport { useAuthConfig } from '../hooks/useAuthConfig';\nimport { useAuthState } from '../state';\nimport { useKeycloak } from '../hooks';\n\nexport interface AfterAuthProps {\n children: ReactNode;\n}\n\nconst logger = console;\n\nexport const AfterAuth: FC<AfterAuthProps> = ({ children }: AfterAuthProps) => {\n const authConfig = useAuthConfig();\n const authState = useAuthState();\n const { token, refreshToken, authenticated, idToken } = useKeycloak();\n\n useEffect(() => {\n if (!authenticated) return;\n if (authConfig.persist && token) {\n authState.setToken(token);\n if (idToken) authState.setIdToken(idToken);\n if (authConfig.ensureFreshness && refreshToken) authState.setRefreshToken(refreshToken);\n }\n }, [token, refreshToken, idToken]);\n\n useEffect(() => {\n if (authConfig.debug && authState.token) logger.debug('token', authState.token);\n }, [authState.token]);\n\n useEffect(() => {\n if (authConfig.debug && authState.idToken) logger.debug('idToken', authState.idToken);\n }, [authState.idToken]);\n\n useEffect(() => {\n if (authConfig.debug && authState.refreshToken) logger.debug('refreshToken', authState.refreshToken);\n }, [authState.refreshToken]);\n\n useEffect(() => {\n if (authConfig.debug) logger.debug('authenticated', authenticated);\n }, [authenticated]);\n\n return <>{children}</>;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkES;AA1CT,mBAAiC;AAEjC,2BAA8B;AAC9B,mBAA6B;AAC7B,mBAA4B;AAM5B,MAAM,SAAS;AAER,MAAM,YAAgC,CAAC,EAAE,SAAS,MAAsB;AAC7E,QAAM,iBAAa,oCAAc;AACjC,QAAM,gBAAY,2BAAa;AAC/B,QAAM,EAAE,OAAO,cAAc,eAAe,QAAQ,QAAI,0BAAY;AAEpE,8BAAU,MAAM;AACd,QAAI,CAAC;AAAe;AACpB,QAAI,WAAW,WAAW,OAAO;AAC/B,gBAAU,SAAS,KAAK;AACxB,UAAI;AAAS,kBAAU,WAAW,OAAO;AACzC,UAAI,WAAW,mBAAmB;AAAc,kBAAU,gBAAgB,YAAY;AAAA,IACxF;AAAA,EACF,GAAG,CAAC,OAAO,cAAc,OAAO,CAAC;AAEjC,8BAAU,MAAM;AACd,QAAI,WAAW,SAAS,UAAU;AAAO,aAAO,MAAM,SAAS,UAAU,KAAK;AAAA,EAChF,GAAG,CAAC,UAAU,KAAK,CAAC;AAEpB,8BAAU,MAAM;AACd,QAAI,WAAW,SAAS,UAAU;AAAS,aAAO,MAAM,WAAW,UAAU,OAAO;AAAA,EACtF,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,8BAAU,MAAM;AACd,QAAI,WAAW,SAAS,UAAU;AAAc,aAAO,MAAM,gBAAgB,UAAU,YAAY;AAAA,EACrG,GAAG,CAAC,UAAU,YAAY,CAAC;AAE3B,8BAAU,MAAM;AACd,QAAI,WAAW;AAAO,aAAO,MAAM,iBAAiB,aAAa;AAAA,EACnE,GAAG,CAAC,aAAa,CAAC;AAElB,SAAO,2EAAG,UAAS;AACrB;",
6
- "names": []
7
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * File: /auth/provider/index.tsx
3
- * Project: app
4
- * File Created: 08-11-2022 06:33:07
5
- * Author: Clay Risser
6
- * -----
7
- * Last Modified: 22-11-2022 18:00:13
8
- * Modified By: Clay Risser
9
- * -----
10
- * Risser Labs LLC (c) Copyright 2021 - 2022
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- import type { AuthClientEvent, AuthClientError, AuthClientTokens } from '@bitspur/react-keycloak-core';
25
- import type { AuthConfig } from '../authConfig';
26
- import type { FC, ComponentType, ReactNode } from 'react';
27
- import type { KeycloakConfig, KeycloakInitOptions } from '@bitspur/keycloak-js';
28
- export interface AuthProviderProps extends Partial<Omit<AuthConfig, 'persist'>>, Partial<Omit<KeycloakConfig, 'url'>>, KeycloakInitOptions {
29
- children: ReactNode;
30
- cookies?: unknown;
31
- disabled?: boolean;
32
- baseUrl?: string;
33
- loadingComponent?: ComponentType;
34
- onEvent?: (eventType: AuthClientEvent, error?: AuthClientError) => void;
35
- onTokens?: (tokens: AuthClientTokens) => void;
36
- }
37
- export declare const AuthProvider: FC<AuthProviderProps>;
38
- export * from './keycloakProvider';
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
- var __objRest = (source, exclude) => {
24
- var target = {};
25
- for (var prop in source)
26
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
- target[prop] = source[prop];
28
- if (source != null && __getOwnPropSymbols)
29
- for (var prop of __getOwnPropSymbols(source)) {
30
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
- target[prop] = source[prop];
32
- }
33
- return target;
34
- };
35
- var __export = (target, all) => {
36
- for (var name in all)
37
- __defProp(target, name, { get: all[name], enumerable: true });
38
- };
39
- var __copyProps = (to, from, except, desc) => {
40
- if (from && typeof from === "object" || typeof from === "function") {
41
- for (let key of __getOwnPropNames(from))
42
- if (!__hasOwnProp.call(to, key) && key !== except)
43
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
44
- }
45
- return to;
46
- };
47
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
48
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
- var provider_exports = {};
50
- __export(provider_exports, {
51
- AuthProvider: () => AuthProvider
52
- });
53
- module.exports = __toCommonJS(provider_exports);
54
- var import_jsx_runtime = require("react/jsx-runtime");
55
- var import_react = require("react");
56
- var import_authConfig = require("../authConfig");
57
- var import_keycloakProvider = require("./keycloakProvider");
58
- var import_hooks = require("../hooks");
59
- var import_config = require("app/config");
60
- __reExport(provider_exports, require("./keycloakProvider"), module.exports);
61
- const persist = import_config.config.get("KEYCLOAK_PERSIST") === "1";
62
- const AuthProvider = (_a) => {
63
- var _b = _a, {
64
- realm: realm,
65
- clientId,
66
- baseUrl,
67
- debug: debug,
68
- ensureFreshness,
69
- loginRoute,
70
- messageHandlerKeys,
71
- ssr,
72
- children: children,
73
- cookies,
74
- disabled,
75
- loadingComponent,
76
- onEvent,
77
- onTokens
78
- } = _b, keycloakInitOptions = __objRest(_b, [
79
- // keycloak config
80
- "realm",
81
- "clientId",
82
- "baseUrl",
83
- // auth config
84
- "debug",
85
- "ensureFreshness",
86
- "loginRoute",
87
- "messageHandlerKeys",
88
- "ssr",
89
- // props
90
- "children",
91
- "cookies",
92
- "disabled",
93
- "loadingComponent",
94
- "onEvent",
95
- "onTokens"
96
- ]);
97
- const tokensFromQuery = (0, import_hooks.useTokensFromQuery)();
98
- const tokensFromState = (0, import_hooks.useTokensFromState)();
99
- const authConfig = (0, import_react.useMemo)(
100
- () => __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, import_authConfig.defaultAuthConfig), typeof debug !== "undefined" ? { debug } : {}), typeof ensureFreshness !== "undefined" ? { ensureFreshness } : {}), typeof loginRoute !== "undefined" ? { loginRoute } : {}), typeof messageHandlerKeys !== "undefined" ? { messageHandlerKeys } : {}), {
101
- persist: !tokensFromState && !tokensFromQuery && cookies && ssr ? false : typeof persist !== "undefined" ? persist : import_authConfig.defaultAuthConfig.persist,
102
- ssr: !tokensFromState && !tokensFromQuery && cookies ? typeof ssr !== "undefined" ? ssr : import_authConfig.defaultAuthConfig.ssr : false
103
- }),
104
- [debug, ensureFreshness, loginRoute, messageHandlerKeys, persist, ssr]
105
- );
106
- if (disabled) {
107
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_authConfig.AuthConfigContext.Provider, { value: authConfig, children });
108
- }
109
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_authConfig.AuthConfigContext.Provider, { value: authConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
- import_keycloakProvider.KeycloakProvider,
111
- {
112
- cookies,
113
- keycloakConfig: {
114
- realm: realm || "main",
115
- clientId: clientId || "app",
116
- url: baseUrl
117
- },
118
- keycloakInitOptions,
119
- loadingComponent,
120
- onEvent,
121
- onTokens,
122
- children
123
- }
124
- ) });
125
- };
126
- // Annotate the CommonJS export names for ESM import in node:
127
- 0 && (module.exports = {
128
- AuthProvider,
129
- ...require("./keycloakProvider")
130
- });
131
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/provider/index.tsx"],
4
- "sourcesContent": ["/**\n * File: /auth/provider/index.tsx\n * Project: app\n * File Created: 08-11-2022 06:33:07\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:00:13\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo } from 'react';\nimport type { AuthClientEvent, AuthClientError, AuthClientTokens } from '@bitspur/react-keycloak-core';\nimport type { AuthConfig } from '../authConfig';\nimport type { FC, ComponentType, ReactNode } from 'react';\nimport type { KeycloakConfig, KeycloakInitOptions } from '@bitspur/keycloak-js';\nimport { AuthConfigContext, defaultAuthConfig } from '../authConfig';\nimport { KeycloakProvider } from './keycloakProvider';\nimport { useTokensFromState, useTokensFromQuery } from '../hooks';\n// @ts-ignore\nimport { config } from 'app/config';\n\nexport interface AuthProviderProps\n extends Partial<Omit<AuthConfig, 'persist'>>,\n Partial<Omit<KeycloakConfig, 'url'>>,\n KeycloakInitOptions {\n children: ReactNode;\n cookies?: unknown;\n disabled?: boolean;\n baseUrl?: string;\n loadingComponent?: ComponentType;\n onEvent?: (eventType: AuthClientEvent, error?: AuthClientError) => void;\n onTokens?: (tokens: AuthClientTokens) => void;\n}\n\nconst persist = config.get('KEYCLOAK_PERSIST') === '1';\n\nexport const AuthProvider: FC<AuthProviderProps> = ({\n // keycloak config\n realm,\n clientId,\n baseUrl,\n // auth config\n debug,\n ensureFreshness,\n loginRoute,\n messageHandlerKeys,\n ssr,\n // props\n children,\n cookies,\n disabled,\n loadingComponent,\n onEvent,\n onTokens,\n ...keycloakInitOptions\n}: AuthProviderProps) => {\n const tokensFromQuery = useTokensFromQuery();\n const tokensFromState = useTokensFromState();\n const authConfig = useMemo(\n () => ({\n ...defaultAuthConfig,\n ...(typeof debug !== 'undefined' ? { debug } : {}),\n ...(typeof ensureFreshness !== 'undefined' ? { ensureFreshness } : {}),\n ...(typeof loginRoute !== 'undefined' ? { loginRoute } : {}),\n ...(typeof messageHandlerKeys !== 'undefined' ? { messageHandlerKeys } : {}),\n persist:\n !tokensFromState && !tokensFromQuery && cookies && ssr\n ? false\n : typeof persist !== 'undefined'\n ? persist\n : defaultAuthConfig.persist,\n ssr:\n !tokensFromState && !tokensFromQuery && cookies\n ? typeof ssr !== 'undefined'\n ? ssr\n : defaultAuthConfig.ssr\n : false,\n }),\n [debug, ensureFreshness, loginRoute, messageHandlerKeys, persist, ssr],\n );\n\n if (disabled) {\n return <AuthConfigContext.Provider value={authConfig}>{children}</AuthConfigContext.Provider>;\n }\n\n return (\n <AuthConfigContext.Provider value={authConfig}>\n <KeycloakProvider\n cookies={cookies}\n keycloakConfig={{\n realm: realm || 'main',\n clientId: clientId || 'app',\n url: baseUrl,\n }}\n keycloakInitOptions={keycloakInitOptions}\n loadingComponent={loadingComponent}\n onEvent={onEvent}\n onTokens={onTokens}\n >\n {children}\n </KeycloakProvider>\n </AuthConfigContext.Provider>\n );\n};\n\nexport * from './keycloakProvider';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgGW;AAxEX,mBAA+B;AAK/B,wBAAqD;AACrD,8BAAiC;AACjC,mBAAuD;AAEvD,oBAAuB;AAsFvB,6BAAc,+BAvHd;AAgDA,MAAM,UAAU,qBAAO,IAAI,kBAAkB,MAAM;AAE5C,MAAM,eAAsC,CAAC,OAmB3B;AAnB2B,eAElD;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAnEF,IAkDoD,IAkB/C,gCAlB+C,IAkB/C;AAAA;AAAA,IAhBH;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,sBAAkB,iCAAmB;AAC3C,QAAM,sBAAkB,iCAAmB;AAC3C,QAAM,iBAAa;AAAA,IACjB,MAAO,6FACF,sCACC,OAAO,UAAU,cAAc,EAAE,MAAM,IAAI,CAAC,IAC5C,OAAO,oBAAoB,cAAc,EAAE,gBAAgB,IAAI,CAAC,IAChE,OAAO,eAAe,cAAc,EAAE,WAAW,IAAI,CAAC,IACtD,OAAO,uBAAuB,cAAc,EAAE,mBAAmB,IAAI,CAAC,IALrE;AAAA,MAML,SACE,CAAC,mBAAmB,CAAC,mBAAmB,WAAW,MAC/C,QACA,OAAO,YAAY,cACnB,UACA,oCAAkB;AAAA,MACxB,KACE,CAAC,mBAAmB,CAAC,mBAAmB,UACpC,OAAO,QAAQ,cACb,MACA,oCAAkB,MACpB;AAAA,IACR;AAAA,IACA,CAAC,OAAO,iBAAiB,YAAY,oBAAoB,SAAS,GAAG;AAAA,EACvE;AAEA,MAAI,UAAU;AACZ,WAAO,4CAAC,oCAAkB,UAAlB,EAA2B,OAAO,YAAa,UAAS;AAAA,EAClE;AAEA,SACE,4CAAC,oCAAkB,UAAlB,EAA2B,OAAO,YACjC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,gBAAgB;AAAA,QACd,OAAO,SAAS;AAAA,QAChB,UAAU,YAAY;AAAA,QACtB,KAAK;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH,GACF;AAEJ;",
6
- "names": []
7
- }