@multiplatform.one/keycloak 0.1.10 → 0.2.1
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/dist/esm/Authenticated.mjs +25 -0
- package/dist/esm/Authenticated.mjs.map +7 -0
- package/dist/esm/authConfig.mjs +10 -0
- package/dist/esm/authConfig.mjs.map +7 -0
- package/dist/esm/hooks/index.mjs +4 -0
- package/dist/esm/hooks/index.mjs.map +7 -0
- package/dist/esm/hooks/useAuthConfig.mjs +9 -0
- package/dist/esm/hooks/useAuthConfig.mjs.map +7 -0
- package/dist/esm/hooks/useCurrentRouteName/index.mjs +17 -0
- package/dist/esm/hooks/useCurrentRouteName/index.mjs.map +7 -0
- package/dist/esm/hooks/useCurrentRouteName/index.native.mjs +12 -0
- package/dist/esm/hooks/useCurrentRouteName/index.native.mjs.map +7 -0
- package/dist/esm/hooks/useKeycloak/index.mjs +2 -0
- package/dist/esm/hooks/useKeycloak/index.mjs.map +7 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs +81 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs.map +7 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs +108 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs.map +7 -0
- package/dist/esm/hooks/useLogin.mjs +35 -0
- package/dist/esm/hooks/useLogin.mjs.map +7 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/esm/provider/afterAuth.mjs +29 -0
- package/dist/esm/provider/afterAuth.mjs.map +7 -0
- package/dist/esm/provider/index.mjs +73 -0
- package/dist/esm/provider/index.mjs.map +7 -0
- package/dist/esm/provider/keycloakProvider.mjs +273 -0
- package/dist/esm/provider/keycloakProvider.mjs.map +7 -0
- package/dist/esm/provider/keycloakProvider.native.mjs +69 -0
- package/dist/esm/provider/keycloakProvider.native.mjs.map +7 -0
- package/dist/esm/state/index.mjs +14 -0
- package/dist/esm/state/index.mjs.map +7 -0
- package/dist/esm/types.mjs +5 -0
- package/dist/esm/types.mjs.map +7 -0
- package/dist/jsx/Authenticated.mjs +20 -0
- package/dist/jsx/Authenticated.mjs.map +7 -0
- package/dist/jsx/authConfig.mjs +10 -0
- package/dist/jsx/authConfig.mjs.map +7 -0
- package/dist/jsx/hooks/index.mjs +4 -0
- package/dist/jsx/hooks/index.mjs.map +7 -0
- package/dist/jsx/hooks/useAuthConfig.mjs +9 -0
- package/dist/jsx/hooks/useAuthConfig.mjs.map +7 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.mjs +17 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.mjs.map +7 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs +12 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs.map +7 -0
- package/dist/jsx/hooks/useKeycloak/index.mjs +2 -0
- package/dist/jsx/hooks/useKeycloak/index.mjs.map +7 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs +25 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs.map +7 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs +58 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs.map +7 -0
- package/dist/jsx/hooks/useLogin.mjs +33 -0
- package/dist/jsx/hooks/useLogin.mjs.map +7 -0
- package/dist/jsx/index.mjs +5 -0
- package/dist/jsx/index.mjs.map +7 -0
- package/dist/jsx/provider/afterAuth.mjs +28 -0
- package/dist/jsx/provider/afterAuth.mjs.map +7 -0
- package/dist/jsx/provider/index.mjs +20 -0
- package/dist/jsx/provider/index.mjs.map +7 -0
- package/dist/jsx/provider/keycloakProvider.mjs +158 -0
- package/dist/jsx/provider/keycloakProvider.mjs.map +7 -0
- package/dist/jsx/provider/keycloakProvider.native.mjs +14 -0
- package/dist/jsx/provider/keycloakProvider.native.mjs.map +7 -0
- package/dist/jsx/state/index.mjs +17 -0
- package/dist/jsx/state/index.mjs.map +7 -0
- package/dist/jsx/types.mjs +5 -0
- package/dist/jsx/types.mjs.map +7 -0
- package/{lib → dist/lib}/Authenticated.d.ts +1 -1
- package/dist/lib/Authenticated.js +60 -0
- package/dist/lib/Authenticated.js.map +7 -0
- package/dist/lib/authConfig.js +35 -0
- package/dist/lib/authConfig.js.map +7 -0
- package/{lib → dist/lib}/hooks/index.d.ts +3 -3
- package/dist/lib/hooks/index.js +27 -0
- package/dist/lib/hooks/index.js.map +7 -0
- package/dist/lib/hooks/useAuthConfig.js +33 -0
- package/dist/lib/hooks/useAuthConfig.js.map +7 -0
- package/{lib/hooks/useCurrentRouteName.d.ts → dist/lib/hooks/useCurrentRouteName/index.d.ts} +5 -5
- package/dist/lib/hooks/useCurrentRouteName/index.js +41 -0
- package/dist/lib/hooks/useCurrentRouteName/index.js.map +7 -0
- package/{esm/types.js → dist/lib/hooks/useCurrentRouteName/index.native.d.ts} +5 -7
- package/dist/lib/hooks/useCurrentRouteName/index.native.js +36 -0
- package/dist/lib/hooks/useCurrentRouteName/index.native.js.map +7 -0
- package/{lib → dist/lib}/hooks/useKeycloak/index.d.ts +11 -4
- package/dist/lib/hooks/useKeycloak/index.js +23 -0
- package/dist/lib/hooks/useKeycloak/index.js.map +7 -0
- package/{lib → dist/lib}/hooks/useKeycloak/useKeycloak.d.ts +2 -2
- package/dist/lib/hooks/useKeycloak/useKeycloak.js +63 -0
- package/dist/lib/hooks/useKeycloak/useKeycloak.js.map +7 -0
- package/{lib → dist/lib}/hooks/useKeycloak/useKeycloak.native.d.ts +4 -4
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js +93 -0
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js.map +7 -0
- package/{lib → dist/lib}/hooks/useLogin.d.ts +1 -1
- package/dist/lib/hooks/useLogin.js +57 -0
- package/dist/lib/hooks/useLogin.js.map +7 -0
- package/{lib → dist/lib}/index.d.ts +4 -4
- package/dist/lib/index.js +29 -0
- package/dist/lib/index.js.map +7 -0
- package/{lib → dist/lib}/provider/afterAuth.d.ts +1 -1
- package/dist/lib/provider/afterAuth.js +53 -0
- package/dist/lib/provider/afterAuth.js.map +7 -0
- package/{lib → dist/lib}/provider/index.d.ts +4 -4
- package/dist/lib/provider/index.js +62 -0
- package/dist/lib/provider/index.js.map +7 -0
- package/{lib → dist/lib}/provider/keycloakProvider.d.ts +2 -2
- package/dist/lib/provider/keycloakProvider.js +212 -0
- package/dist/lib/provider/keycloakProvider.js.map +7 -0
- package/{lib → dist/lib}/provider/keycloakProvider.native.d.ts +2 -2
- package/dist/lib/provider/keycloakProvider.native.js +55 -0
- package/dist/lib/provider/keycloakProvider.native.js.map +7 -0
- package/{esm/state/index.js → dist/lib/state/index.d.ts} +8 -13
- package/dist/lib/state/index.js +41 -0
- package/dist/lib/state/index.js.map +7 -0
- package/dist/lib/tsconfig.build.tsbuildinfo +1 -0
- package/dist/lib/types.js +25 -0
- package/dist/lib/types.js.map +7 -0
- package/package.json +44 -63
- package/src/@types/coreJsPure.d.ts +2 -2
- package/src/@types/expoKeycloakAuth.d.ts +1 -1
- package/src/Authenticated.tsx +5 -8
- package/src/authConfig.ts +1 -1
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useAuthConfig.ts +2 -2
- package/{esm/hooks/useCurrentRouteName.js → src/hooks/useCurrentRouteName/index.native.ts} +8 -13
- package/src/hooks/{useCurrentRouteName.ts → useCurrentRouteName/index.ts} +8 -8
- package/src/hooks/useKeycloak/index.ts +12 -8
- package/src/hooks/useKeycloak/useKeycloak.native.ts +18 -32
- package/src/hooks/useKeycloak/useKeycloak.ts +7 -7
- package/src/hooks/useLogin.ts +7 -7
- package/src/index.ts +4 -4
- package/src/provider/afterAuth.tsx +10 -11
- package/src/provider/index.tsx +9 -12
- package/src/provider/keycloakProvider.native.tsx +8 -10
- package/src/provider/keycloakProvider.tsx +44 -61
- package/src/state/index.ts +13 -10
- package/esm/Authenticated.js +0 -42
- package/esm/Authenticated.js.map +0 -1
- package/esm/authConfig.js +0 -30
- package/esm/authConfig.js.map +0 -1
- package/esm/hooks/index.js +0 -28
- package/esm/hooks/index.js.map +0 -1
- package/esm/hooks/useAuthConfig.js +0 -30
- package/esm/hooks/useAuthConfig.js.map +0 -1
- package/esm/hooks/useCurrentRouteName.js.map +0 -1
- package/esm/hooks/useKeycloak/index.js +0 -27
- package/esm/hooks/useKeycloak/index.js.map +0 -1
- package/esm/hooks/useKeycloak/useKeycloak.js +0 -55
- package/esm/hooks/useKeycloak/useKeycloak.js.map +0 -1
- package/esm/hooks/useKeycloak/useKeycloak.native.js +0 -91
- package/esm/hooks/useKeycloak/useKeycloak.native.js.map +0 -1
- package/esm/hooks/useLogin.js +0 -50
- package/esm/hooks/useLogin.js.map +0 -1
- package/esm/index.js +0 -29
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -1
- package/esm/provider/afterAuth.js +0 -58
- package/esm/provider/afterAuth.js.map +0 -1
- package/esm/provider/index.js +0 -43
- package/esm/provider/index.js.map +0 -1
- package/esm/provider/keycloakProvider.js +0 -175
- package/esm/provider/keycloakProvider.js.map +0 -1
- package/esm/provider/keycloakProvider.native.js +0 -41
- package/esm/provider/keycloakProvider.native.js.map +0 -1
- package/esm/state/index.js.map +0 -1
- package/esm/types.js.map +0 -1
- package/lib/Authenticated.js +0 -64
- package/lib/Authenticated.js.map +0 -1
- package/lib/authConfig.js +0 -51
- package/lib/authConfig.js.map +0 -1
- package/lib/hooks/index.js +0 -50
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/useAuthConfig.js +0 -48
- package/lib/hooks/useAuthConfig.js.map +0 -1
- package/lib/hooks/useCurrentRouteName.js +0 -54
- package/lib/hooks/useCurrentRouteName.js.map +0 -1
- package/lib/hooks/useKeycloak/index.js +0 -30
- package/lib/hooks/useKeycloak/index.js.map +0 -1
- package/lib/hooks/useKeycloak/useKeycloak.js +0 -71
- package/lib/hooks/useKeycloak/useKeycloak.js.map +0 -1
- package/lib/hooks/useKeycloak/useKeycloak.native.js +0 -112
- package/lib/hooks/useKeycloak/useKeycloak.native.js.map +0 -1
- package/lib/hooks/useLogin.js +0 -65
- package/lib/hooks/useLogin.js.map +0 -1
- package/lib/index.js +0 -60
- package/lib/index.js.map +0 -1
- package/lib/package.json +0 -1
- package/lib/provider/afterAuth.js +0 -78
- package/lib/provider/afterAuth.js.map +0 -1
- package/lib/provider/index.js +0 -77
- package/lib/provider/index.js.map +0 -1
- package/lib/provider/keycloakProvider.js +0 -193
- package/lib/provider/keycloakProvider.js.map +0 -1
- package/lib/provider/keycloakProvider.native.js +0 -61
- package/lib/provider/keycloakProvider.native.js.map +0 -1
- package/lib/state/index.d.ts +0 -34
- package/lib/state/index.js +0 -55
- package/lib/state/index.js.map +0 -1
- package/lib/tsconfig.build.tsbuildinfo +0 -1
- package/lib/types.js +0 -46
- package/lib/types.js.map +0 -1
- /package/{lib → dist/lib}/authConfig.d.ts +0 -0
- /package/{lib → dist/lib}/hooks/useAuthConfig.d.ts +0 -0
- /package/{lib → dist/lib}/types.d.ts +0 -0
package/lib/provider/index.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "react", "../authConfig", "./keycloakProvider"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("react"), require("../authConfig"), require("./keycloakProvider"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.react, global.authConfig, global.keycloakProvider);
|
|
11
|
-
global.index = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _authConfig, _keycloakProvider) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
var _exportNames = {
|
|
20
|
-
AuthProvider: true
|
|
21
|
-
};
|
|
22
|
-
_exports.AuthProvider = void 0;
|
|
23
|
-
_react = _interopRequireWildcard(_react);
|
|
24
|
-
Object.keys(_keycloakProvider).forEach(function (key) {
|
|
25
|
-
if (key === "default" || key === "__esModule") return;
|
|
26
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
-
if (key in _exports && _exports[key] === _keycloakProvider[key]) return;
|
|
28
|
-
Object.defineProperty(_exports, key, {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
return _keycloakProvider[key];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
36
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
-
/**
|
|
38
|
-
* File: /auth/provider/index.tsx
|
|
39
|
-
* Project: app
|
|
40
|
-
* File Created: 08-11-2022 06:33:07
|
|
41
|
-
* Author: Clay Risser
|
|
42
|
-
* -----
|
|
43
|
-
* Last Modified: 22-11-2022 18:00:13
|
|
44
|
-
* Modified By: Clay Risser
|
|
45
|
-
* -----
|
|
46
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
47
|
-
*
|
|
48
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
49
|
-
* you may not use this file except in compliance with the License.
|
|
50
|
-
* You may obtain a copy of the License at
|
|
51
|
-
*
|
|
52
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
53
|
-
*
|
|
54
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
55
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
56
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
57
|
-
* See the License for the specific language governing permissions and
|
|
58
|
-
* limitations under the License.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
const AuthProvider = props => {
|
|
62
|
-
const {
|
|
63
|
-
authConfig,
|
|
64
|
-
debug
|
|
65
|
-
} = props;
|
|
66
|
-
const authConfigValue = (0, _react.useMemo)(() => ({
|
|
67
|
-
..._authConfig.defaultAuthConfig,
|
|
68
|
-
...authConfig,
|
|
69
|
-
debug: !!debug
|
|
70
|
-
}), []);
|
|
71
|
-
return /*#__PURE__*/_react.default.createElement(_authConfig.AuthConfigContext.Provider, {
|
|
72
|
-
value: authConfigValue
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(_keycloakProvider.KeycloakProvider, props));
|
|
74
|
-
};
|
|
75
|
-
_exports.AuthProvider = AuthProvider;
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["AuthProvider","props","authConfig","debug","authConfigValue","useMemo","defaultAuthConfig"],"sources":["../../src/provider/index.tsx"],"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, { FC, useMemo } from \"react\";\nimport {\n AuthConfig,\n AuthConfigContext,\n defaultAuthConfig,\n} from \"../authConfig\";\nimport { KeycloakProvider, KeycloakProviderProps } from \"./keycloakProvider\";\n\nexport interface AuthProviderProps extends KeycloakProviderProps {\n authConfig?: Partial<AuthConfig>;\n}\n\nexport const AuthProvider: FC<AuthProviderProps> = (\n props: AuthProviderProps\n) => {\n const { authConfig, debug } = props;\n const authConfigValue = useMemo(\n () => ({\n ...defaultAuthConfig,\n ...authConfig,\n debug: !!debug,\n }),\n []\n );\n\n return (\n <AuthConfigContext.Provider value={authConfigValue}>\n <KeycloakProvider {...props} />\n </AuthConfigContext.Provider>\n );\n};\n\nexport * from \"./keycloakProvider\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAwDA;IAAA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EAAmC;EAAA;EAxDnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAcO,MAAMA,YAAmC,GAC9CC,KAAwB,IACrB;IACH,MAAM;MAAEC,UAAU;MAAEC;IAAM,CAAC,GAAGF,KAAK;IACnC,MAAMG,eAAe,GAAG,IAAAC,cAAO,EAC7B,OAAO;MACL,GAAGC,6BAAiB;MACpB,GAAGJ,UAAU;MACbC,KAAK,EAAE,CAAC,CAACA;IACX,CAAC,CAAC,EACF,EAAE,CACH;IAED,oBACE,6BAAC,6BAAiB,CAAC,QAAQ;MAAC,KAAK,EAAEC;IAAgB,gBACjD,6BAAC,kCAAgB,EAAKH,KAAK,CAAI,CACJ;EAEjC,CAAC;EAAC;AAAA"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "keycloak-js", "multiplatform.one", "@react-keycloak/web", "@react-keycloak/ssr", "next/router", "react", "../hooks/useAuthConfig", "../state", "./afterAuth"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("keycloak-js"), require("multiplatform.one"), require("@react-keycloak/web"), require("@react-keycloak/ssr"), require("next/router"), require("react"), require("../hooks/useAuthConfig"), require("../state"), require("./afterAuth"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.keycloakJs, global.multiplatform, global.web, global.ssr, global.router, global.react, global.useAuthConfig, global.state, global.afterAuth);
|
|
11
|
-
global.keycloakProvider = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _keycloakJs, _multiplatform, _web, _ssr, _router, _react, _useAuthConfig, _state, _afterAuth) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
17
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
});
|
|
20
|
-
_exports.defaultKeycloakInitOptions = _exports.KeycloakProvider = void 0;
|
|
21
|
-
_keycloakJs = _interopRequireDefault(_keycloakJs);
|
|
22
|
-
_react = _interopRequireWildcard(_react);
|
|
23
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
/**
|
|
26
|
-
* File: /auth/provider/keycloakProvider.tsx
|
|
27
|
-
* Project: app
|
|
28
|
-
* File Created: 08-11-2022 03:12:43
|
|
29
|
-
* Author: Clay Risser
|
|
30
|
-
* -----
|
|
31
|
-
* Last Modified: 22-11-2022 18:07:46
|
|
32
|
-
* Modified By: Clay Risser
|
|
33
|
-
* -----
|
|
34
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
35
|
-
*
|
|
36
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
37
|
-
* you may not use this file except in compliance with the License.
|
|
38
|
-
* You may obtain a copy of the License at
|
|
39
|
-
*
|
|
40
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
41
|
-
*
|
|
42
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
43
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
44
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
45
|
-
* See the License for the specific language governing permissions and
|
|
46
|
-
* limitations under the License.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
const logger = console;
|
|
50
|
-
const KeycloakProvider = _ref => {
|
|
51
|
-
var _query$token, _query$refreshToken;
|
|
52
|
-
let {
|
|
53
|
-
children,
|
|
54
|
-
cookies,
|
|
55
|
-
debug,
|
|
56
|
-
keycloakConfig,
|
|
57
|
-
keycloakInitOptions,
|
|
58
|
-
loadingComponent
|
|
59
|
-
} = _ref;
|
|
60
|
-
const [auth] = (0, _state.useAuthState)();
|
|
61
|
-
const LoadingComponent = loadingComponent || (() => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, debug ? "authenticating" : null));
|
|
62
|
-
const {
|
|
63
|
-
query
|
|
64
|
-
} = _multiplatform.MultiPlatform.isNext ? (0, _router.useRouter)() : {
|
|
65
|
-
query: {}
|
|
66
|
-
};
|
|
67
|
-
const authConfig = (0, _useAuthConfig.useAuthConfig)();
|
|
68
|
-
const [token, setToken] = (0, _react.useState)("token" in query && (((_query$token = query.token) === null || _query$token === void 0 ? void 0 : _query$token.toString()) || true) || auth.token || false);
|
|
69
|
-
const [refreshToken, setRefreshToken] = (0, _react.useState)("refreshToken" in query && (((_query$refreshToken = query.refreshToken) === null || _query$refreshToken === void 0 ? void 0 : _query$refreshToken.toString()) || true) || auth.refreshToken || false);
|
|
70
|
-
(0, _react.useEffect)(() => {
|
|
71
|
-
var _window2, _window2$ReactNativeW, _window3, _window3$parent;
|
|
72
|
-
if (token !== true && refreshToken !== true) return;
|
|
73
|
-
if (debug) logger.debug("post message", {
|
|
74
|
-
type: "LOADED"
|
|
75
|
-
});
|
|
76
|
-
(authConfig.messageHandlerKeys || []).forEach(key => {
|
|
77
|
-
var _window, _window$webkit, _window$webkit$messag, _window$webkit$messag2;
|
|
78
|
-
(_window = window) === null || _window === void 0 ? void 0 : (_window$webkit = _window.webkit) === null || _window$webkit === void 0 ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) === null || _window$webkit$messag === void 0 ? void 0 : (_window$webkit$messag2 = _window$webkit$messag[key]) === null || _window$webkit$messag2 === void 0 ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
|
|
79
|
-
type: "LOADED"
|
|
80
|
-
}));
|
|
81
|
-
});
|
|
82
|
-
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$ReactNativeW = _window2.ReactNativeWebView) === null || _window2$ReactNativeW === void 0 ? void 0 : _window2$ReactNativeW.postMessage(JSON.stringify({
|
|
83
|
-
type: "LOADED"
|
|
84
|
-
}));
|
|
85
|
-
(_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$parent = _window3.parent) === null || _window3$parent === void 0 ? void 0 : _window3$parent.postMessage(JSON.stringify({
|
|
86
|
-
type: "LOADED"
|
|
87
|
-
}));
|
|
88
|
-
}, []);
|
|
89
|
-
(0, _react.useEffect)(() => {
|
|
90
|
-
if (token !== true) return;
|
|
91
|
-
const messageCallback = e => {
|
|
92
|
-
let data = e === null || e === void 0 ? void 0 : e.data;
|
|
93
|
-
if (typeof data === "string") {
|
|
94
|
-
try {
|
|
95
|
-
data = JSON.parse(data);
|
|
96
|
-
} catch (err) {}
|
|
97
|
-
}
|
|
98
|
-
if (debug) logger.debug("received message", data);
|
|
99
|
-
const message = data;
|
|
100
|
-
if (!message.type) return;
|
|
101
|
-
if (message.type.toUpperCase() === "TOKEN" && message.payload) {
|
|
102
|
-
if (debug) logger.debug("setting token", message.payload);
|
|
103
|
-
setToken(message.payload);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
if (debug) logger.debug("listening for message", {
|
|
107
|
-
type: "TOKEN",
|
|
108
|
-
payload: "<some_token>"
|
|
109
|
-
});
|
|
110
|
-
window.addEventListener("message", messageCallback);
|
|
111
|
-
return () => {
|
|
112
|
-
window.removeEventListener("message", messageCallback);
|
|
113
|
-
};
|
|
114
|
-
}, []);
|
|
115
|
-
(0, _react.useEffect)(() => {
|
|
116
|
-
if (refreshToken !== true) return;
|
|
117
|
-
const messageCallback = e => {
|
|
118
|
-
let data = e === null || e === void 0 ? void 0 : e.data;
|
|
119
|
-
if (typeof data === "string") {
|
|
120
|
-
try {
|
|
121
|
-
data = JSON.parse(data);
|
|
122
|
-
} catch (err) {}
|
|
123
|
-
}
|
|
124
|
-
if (debug) logger.debug("received message", data);
|
|
125
|
-
const message = data;
|
|
126
|
-
if (!message.type) return;
|
|
127
|
-
if (message.type.toUpperCase() === "REFRESH_TOKEN" && message.payload) {
|
|
128
|
-
if (debug) logger.debug("setting refresh token", message.payload);
|
|
129
|
-
setRefreshToken(message.payload);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
if (debug) logger.debug("listening for message", {
|
|
133
|
-
type: "REFRESH_TOKEN",
|
|
134
|
-
payload: "<some_refresh_token>"
|
|
135
|
-
});
|
|
136
|
-
window.addEventListener("message", messageCallback);
|
|
137
|
-
return () => {
|
|
138
|
-
window.removeEventListener("message", messageCallback);
|
|
139
|
-
};
|
|
140
|
-
}, []);
|
|
141
|
-
const keycloak = (0, _react.useMemo)(() => typeof window !== "undefined" && new _keycloakJs.default({
|
|
142
|
-
url: keycloakConfig.baseUrl,
|
|
143
|
-
realm: keycloakConfig.realm,
|
|
144
|
-
clientId: keycloakConfig.clientId
|
|
145
|
-
}), []);
|
|
146
|
-
const initOptions = (0, _react.useMemo)(() => {
|
|
147
|
-
const initOptions = {
|
|
148
|
-
...defaultKeycloakInitOptions,
|
|
149
|
-
...keycloakInitOptions
|
|
150
|
-
};
|
|
151
|
-
if (token && typeof token === "string") {
|
|
152
|
-
initOptions.token = token;
|
|
153
|
-
if (refreshToken && typeof refreshToken === "string") initOptions.refreshToken = refreshToken;
|
|
154
|
-
initOptions.checkLoginIframe = false;
|
|
155
|
-
initOptions.onLoad = undefined;
|
|
156
|
-
}
|
|
157
|
-
return initOptions;
|
|
158
|
-
}, [keycloakInitOptions, token, refreshToken]);
|
|
159
|
-
if (token === true || refreshToken === true) return /*#__PURE__*/_react.default.createElement(LoadingComponent, null);
|
|
160
|
-
if (cookies && authConfig.ssr) {
|
|
161
|
-
return (
|
|
162
|
-
/*#__PURE__*/
|
|
163
|
-
// @ts-ignore
|
|
164
|
-
_react.default.createElement(_ssr.SSRKeycloakProvider, {
|
|
165
|
-
initOptions: initOptions,
|
|
166
|
-
keycloakConfig: {
|
|
167
|
-
url: keycloakConfig.baseUrl,
|
|
168
|
-
realm: keycloakConfig.realm,
|
|
169
|
-
clientId: keycloakConfig.clientId
|
|
170
|
-
},
|
|
171
|
-
persistor: (0, _ssr.SSRCookies)(cookies),
|
|
172
|
-
LoadingComponent: /*#__PURE__*/_react.default.createElement(LoadingComponent, null)
|
|
173
|
-
}, /*#__PURE__*/_react.default.createElement(_afterAuth.AfterAuth, null, children))
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
if (!keycloak) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
177
|
-
return /*#__PURE__*/_react.default.createElement(_web.ReactKeycloakProvider, {
|
|
178
|
-
initOptions: initOptions,
|
|
179
|
-
authClient: keycloak,
|
|
180
|
-
LoadingComponent: /*#__PURE__*/_react.default.createElement(LoadingComponent, null)
|
|
181
|
-
}, /*#__PURE__*/_react.default.createElement(_afterAuth.AfterAuth, null, children));
|
|
182
|
-
};
|
|
183
|
-
_exports.KeycloakProvider = KeycloakProvider;
|
|
184
|
-
const defaultKeycloakInitOptions = {
|
|
185
|
-
checkLoginIframe: true,
|
|
186
|
-
checkLoginIframeInterval: 5,
|
|
187
|
-
enableLogging: false,
|
|
188
|
-
onLoad: "check-sso",
|
|
189
|
-
pkceMethod: "S256"
|
|
190
|
-
};
|
|
191
|
-
_exports.defaultKeycloakInitOptions = defaultKeycloakInitOptions;
|
|
192
|
-
});
|
|
193
|
-
//# sourceMappingURL=keycloakProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keycloakProvider.js","names":["logger","console","KeycloakProvider","children","cookies","debug","keycloakConfig","keycloakInitOptions","loadingComponent","auth","useAuthState","LoadingComponent","query","MultiPlatform","isNext","useRouter","authConfig","useAuthConfig","token","setToken","useState","toString","refreshToken","setRefreshToken","useEffect","type","messageHandlerKeys","forEach","key","window","webkit","messageHandlers","postMessage","JSON","stringify","ReactNativeWebView","parent","messageCallback","e","data","parse","err","message","toUpperCase","payload","addEventListener","removeEventListener","keycloak","useMemo","Keycloak","url","baseUrl","realm","clientId","initOptions","defaultKeycloakInitOptions","checkLoginIframe","onLoad","undefined","ssr","SSRCookies","checkLoginIframeInterval","enableLogging","pkceMethod"],"sources":["../../src/provider/keycloakProvider.tsx"],"sourcesContent":["/**\n * File: /auth/provider/keycloakProvider.tsx\n * Project: app\n * File Created: 08-11-2022 03:12:43\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:07:46\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 Keycloak, { KeycloakInitOptions } from \"keycloak-js\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { ReactKeycloakProvider } from \"@react-keycloak/web\";\nimport { SSRKeycloakProvider, SSRCookies } from \"@react-keycloak/ssr\";\nimport { useRouter } from \"next/router\";\nimport React, {\n FC,\n ReactNode,\n useMemo,\n useEffect,\n useState,\n ComponentType,\n} from \"react\";\nimport { useAuthConfig } from \"../hooks/useAuthConfig\";\nimport { useAuthState } from \"../state\";\nimport { AfterAuth } from \"./afterAuth\";\n\nexport interface KeycloakProviderProps {\n children: ReactNode;\n cookies?: unknown;\n debug?: boolean;\n disabled?: boolean;\n keycloakConfig: KeycloakConfig;\n keycloakInitOptions?: KeycloakInitOptions;\n loadingComponent?: ComponentType;\n}\n\nconst logger = console;\n\nexport const KeycloakProvider: FC<KeycloakProviderProps> = ({\n children,\n cookies,\n debug,\n keycloakConfig,\n keycloakInitOptions,\n loadingComponent,\n}: KeycloakProviderProps) => {\n const [auth] = useAuthState();\n const LoadingComponent =\n loadingComponent || (() => <>{debug ? \"authenticating\" : null}</>);\n const { query } = MultiPlatform.isNext ? useRouter() : { query: {} };\n const authConfig = useAuthConfig();\n const [token, setToken] = useState<string | boolean>(\n (\"token\" in query && (query.token?.toString() || true)) ||\n auth.token ||\n false\n );\n const [refreshToken, setRefreshToken] = useState<string | boolean>(\n (\"refreshToken\" in query && (query.refreshToken?.toString() || true)) ||\n auth.refreshToken ||\n false\n );\n\n useEffect(() => {\n if (token !== true && refreshToken !== true) return;\n if (debug) logger.debug(\"post message\", { type: \"LOADED\" });\n (authConfig.messageHandlerKeys || []).forEach((key: string) => {\n window?.webkit?.messageHandlers?.[key]?.postMessage(\n JSON.stringify({ type: \"LOADED\" })\n );\n });\n window?.ReactNativeWebView?.postMessage(JSON.stringify({ type: \"LOADED\" }));\n window?.parent?.postMessage(JSON.stringify({ type: \"LOADED\" }));\n }, []);\n\n useEffect(() => {\n if (token !== true) return;\n const messageCallback = (e: MessageEvent<any>) => {\n let data = e?.data;\n if (typeof data === \"string\") {\n try {\n data = JSON.parse(data);\n } catch (err) {}\n }\n if (debug) logger.debug(\"received message\", data);\n const message: MessageSchema = data;\n if (!message.type) return;\n if (message.type.toUpperCase() === \"TOKEN\" && message.payload) {\n if (debug) logger.debug(\"setting token\", message.payload);\n setToken(message.payload);\n }\n };\n if (debug)\n logger.debug(\"listening for message\", {\n type: \"TOKEN\",\n payload: \"<some_token>\",\n });\n window.addEventListener(\"message\", messageCallback);\n return () => {\n window.removeEventListener(\"message\", messageCallback);\n };\n }, []);\n\n useEffect(() => {\n if (refreshToken !== true) return;\n const messageCallback = (e: MessageEvent<any>) => {\n let data = e?.data;\n if (typeof data === \"string\") {\n try {\n data = JSON.parse(data);\n } catch (err) {}\n }\n if (debug) logger.debug(\"received message\", data);\n const message: MessageSchema = data;\n if (!message.type) return;\n if (message.type.toUpperCase() === \"REFRESH_TOKEN\" && message.payload) {\n if (debug) logger.debug(\"setting refresh token\", message.payload);\n setRefreshToken(message.payload);\n }\n };\n if (debug)\n logger.debug(\"listening for message\", {\n type: \"REFRESH_TOKEN\",\n payload: \"<some_refresh_token>\",\n });\n window.addEventListener(\"message\", messageCallback);\n return () => {\n window.removeEventListener(\"message\", messageCallback);\n };\n }, []);\n\n const keycloak = useMemo(\n () =>\n typeof window !== \"undefined\" &&\n new Keycloak({\n url: keycloakConfig.baseUrl,\n realm: keycloakConfig.realm,\n clientId: keycloakConfig.clientId,\n }),\n []\n );\n\n const initOptions = useMemo(() => {\n const initOptions = {\n ...defaultKeycloakInitOptions,\n ...keycloakInitOptions,\n };\n if (token && typeof token === \"string\") {\n initOptions.token = token;\n if (refreshToken && typeof refreshToken === \"string\")\n initOptions.refreshToken = refreshToken;\n initOptions.checkLoginIframe = false;\n initOptions.onLoad = undefined;\n }\n return initOptions;\n }, [keycloakInitOptions, token, refreshToken]);\n\n if (token === true || refreshToken === true) return <LoadingComponent />;\n if (cookies && authConfig.ssr) {\n return (\n // @ts-ignore\n <SSRKeycloakProvider\n initOptions={initOptions}\n keycloakConfig={{\n url: keycloakConfig.baseUrl,\n realm: keycloakConfig.realm,\n clientId: keycloakConfig.clientId,\n }}\n persistor={SSRCookies(cookies)}\n LoadingComponent={<LoadingComponent />}\n >\n <AfterAuth>{children}</AfterAuth>\n </SSRKeycloakProvider>\n );\n }\n if (!keycloak) return <>{children}</>;\n return (\n <ReactKeycloakProvider\n initOptions={initOptions}\n authClient={keycloak}\n LoadingComponent={<LoadingComponent />}\n >\n <AfterAuth>{children}</AfterAuth>\n </ReactKeycloakProvider>\n );\n};\n\nexport interface KeycloakConfig {\n clientId: string;\n realm: string;\n scheme?: string;\n baseUrl: string;\n}\n\nexport const defaultKeycloakInitOptions: KeycloakInitOptions = {\n checkLoginIframe: true,\n checkLoginIframeInterval: 5,\n enableLogging: false,\n onLoad: \"check-sso\",\n pkceMethod: \"S256\",\n};\n\nexport interface MessageSchema {\n type: string;\n payload?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EA6BA,MAAMA,MAAM,GAAGC,OAAO;EAEf,MAAMC,gBAA2C,GAAG,QAO9B;IAAA;IAAA,IAP+B;MAC1DC,QAAQ;MACRC,OAAO;MACPC,KAAK;MACLC,cAAc;MACdC,mBAAmB;MACnBC;IACqB,CAAC;IACtB,MAAM,CAACC,IAAI,CAAC,GAAG,IAAAC,mBAAY,GAAE;IAC7B,MAAMC,gBAAgB,GACpBH,gBAAgB,KAAK,mBAAM,4DAAGH,KAAK,GAAG,gBAAgB,GAAG,IAAI,CAAI,CAAC;IACpE,MAAM;MAAEO;IAAM,CAAC,GAAGC,4BAAa,CAACC,MAAM,GAAG,IAAAC,iBAAS,GAAE,GAAG;MAAEH,KAAK,EAAE,CAAC;IAAE,CAAC;IACpE,MAAMI,UAAU,GAAG,IAAAC,4BAAa,GAAE;IAClC,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAC/B,OAAO,IAAIR,KAAK,KAAK,iBAAAA,KAAK,CAACM,KAAK,iDAAX,aAAaG,QAAQ,EAAE,KAAI,IAAI,CAAC,IACpDZ,IAAI,CAACS,KAAK,IACV,KAAK,CACR;IACD,MAAM,CAACI,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAH,eAAQ,EAC7C,cAAc,IAAIR,KAAK,KAAK,wBAAAA,KAAK,CAACU,YAAY,wDAAlB,oBAAoBD,QAAQ,EAAE,KAAI,IAAI,CAAC,IAClEZ,IAAI,CAACa,YAAY,IACjB,KAAK,CACR;IAED,IAAAE,gBAAS,EAAC,MAAM;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AAC,gBAAgB,OAAG;IACxE,IAAIlB,OAAO,IAAIY,UAAU,CAAC2C,GAAG,EAAE;MAC7B;QAAA;QACE;QACA,6BAAC,wBAAmB;UAClB,WAAW,EAAEL,WAAY;UACzB,cAAc,EAAE;YACdJ,GAAG,EAAE5C,cAAc,CAAC6C,OAAO;YAC3BC,KAAK,EAAE9C,cAAc,CAAC8C,KAAK;YAC3BC,QAAQ,EAAE/C,cAAc,CAAC+C;UAC3B,CAAE;UACF,SAAS,EAAE,IAAAO,eAAU,EAACxD,OAAO,CAAE;UAC/B,gBAAgB,eAAE,6BAAC,gBAAgB;QAAI,gBAEvC,6BAAC,oBAAS,QAAED,QAAQ,CAAa;MACb;IAE1B;IACA,IAAI,CAAC4C,QAAQ,EAAE,oBAAO,4DAAG5C,QAAQ,CAAI;IACrC,oBACE,6BAAC,0BAAqB;MACpB,WAAW,EAAEmD,WAAY;MACzB,UAAU,EAAEP,QAAS;MACrB,gBAAgB,eAAE,6BAAC,gBAAgB;IAAI,gBAEvC,6BAAC,oBAAS,QAAE5C,QAAQ,CAAa,CACX;EAE5B,CAAC;EAAC;EASK,MAAMoD,0BAA+C,GAAG;IAC7DC,gBAAgB,EAAE,IAAI;IACtBK,wBAAwB,EAAE,CAAC;IAC3BC,aAAa,EAAE,KAAK;IACpBL,MAAM,EAAE,WAAW;IACnBM,UAAU,EAAE;EACd,CAAC;EAAC;AAAA"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "react", "./afterAuth", "expo-keycloak-auth"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("react"), require("./afterAuth"), require("expo-keycloak-auth"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.react, global.afterAuth, global.expoKeycloakAuth);
|
|
11
|
-
global.keycloakProviderNative = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _afterAuth, _expoKeycloakAuth) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
17
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
});
|
|
20
|
-
_exports.KeycloakProvider = void 0;
|
|
21
|
-
_react = _interopRequireDefault(_react);
|
|
22
|
-
/**
|
|
23
|
-
* File: /auth/provider/keycloakProvider.native.tsx
|
|
24
|
-
* Project: app
|
|
25
|
-
* File Created: 08-11-2022 03:12:37
|
|
26
|
-
* Author: Clay Risser
|
|
27
|
-
* -----
|
|
28
|
-
* Last Modified: 22-11-2022 17:52:31
|
|
29
|
-
* Modified By: Clay Risser
|
|
30
|
-
* -----
|
|
31
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
32
|
-
*
|
|
33
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
34
|
-
* you may not use this file except in compliance with the License.
|
|
35
|
-
* You may obtain a copy of the License at
|
|
36
|
-
*
|
|
37
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
-
*
|
|
39
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
40
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
42
|
-
* See the License for the specific language governing permissions and
|
|
43
|
-
* limitations under the License.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
const KeycloakProvider = _ref => {
|
|
47
|
-
let {
|
|
48
|
-
children,
|
|
49
|
-
keycloakConfig
|
|
50
|
-
} = _ref;
|
|
51
|
-
const clonedKeycloakConfig = {
|
|
52
|
-
...keycloakConfig,
|
|
53
|
-
url: keycloakConfig.baseUrl
|
|
54
|
-
};
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
delete keycloakConfig.baseUrl;
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement(_expoKeycloakAuth.KeycloakProvider, clonedKeycloakConfig, /*#__PURE__*/_react.default.createElement(_afterAuth.AfterAuth, null, children));
|
|
58
|
-
};
|
|
59
|
-
_exports.KeycloakProvider = KeycloakProvider;
|
|
60
|
-
});
|
|
61
|
-
//# sourceMappingURL=keycloakProvider.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keycloakProvider.native.js","names":["KeycloakProvider","children","keycloakConfig","clonedKeycloakConfig","url","baseUrl"],"sources":["../../src/provider/keycloakProvider.native.tsx"],"sourcesContent":["/**\n * File: /auth/provider/keycloakProvider.native.tsx\n * Project: app\n * File Created: 08-11-2022 03:12:37\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 17:52:31\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, { FC } from \"react\";\nimport type { KeycloakProviderProps } from \"./keycloakProvider\";\nimport { AfterAuth } from \"./afterAuth\";\nimport { KeycloakConfig } from \"keycloak-js\";\nimport { KeycloakProvider as ExpoKeycloakProvider } from \"expo-keycloak-auth\";\n\nexport const KeycloakProvider: FC<KeycloakProviderProps> = ({\n children,\n keycloakConfig,\n}: KeycloakProviderProps) => {\n const clonedKeycloakConfig = {\n ...(keycloakConfig as Omit<KeycloakConfig, \"baseUrl\">),\n url: keycloakConfig.baseUrl,\n };\n // @ts-ignore\n delete keycloakConfig.baseUrl;\n return (\n <ExpoKeycloakProvider {...clonedKeycloakConfig}>\n <AfterAuth>{children}</AfterAuth>\n </ExpoKeycloakProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAQO,MAAMA,gBAA2C,GAAG,QAG9B;IAAA,IAH+B;MAC1DC,QAAQ;MACRC;IACqB,CAAC;IACtB,MAAMC,oBAAoB,GAAG;MAC3B,GAAID,cAAkD;MACtDE,GAAG,EAAEF,cAAc,CAACG;IACtB,CAAC;IACD;IACA,OAAOH,cAAc,CAACG,OAAO;IAC7B,oBACE,6BAAC,kCAAoB,EAAKF,oBAAoB,eAC5C,6BAAC,oBAAS,QAAEF,QAAQ,CAAa,CACZ;EAE3B,CAAC;EAAC;AAAA"}
|
package/lib/state/index.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/state/index.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 22-11-2022 17:40:53
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 01-02-2023 14:38:51
|
|
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
|
-
export declare function useAuthState(): [{
|
|
25
|
-
token?: string | undefined;
|
|
26
|
-
refreshToken?: string | undefined;
|
|
27
|
-
}, import("recoil").SetterOrUpdater<{
|
|
28
|
-
token?: string | undefined;
|
|
29
|
-
refreshToken?: string | undefined;
|
|
30
|
-
}>];
|
|
31
|
-
export declare const authState: import("recoil").RecoilState<{
|
|
32
|
-
token?: string | undefined;
|
|
33
|
-
refreshToken?: string | undefined;
|
|
34
|
-
}>;
|
package/lib/state/index.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "recoil", "multiplatform.one/recoil"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("recoil"), require("multiplatform.one/recoil"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.recoil, global.recoil);
|
|
11
|
-
global.index = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _recoil, _recoil2) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
_exports.authState = void 0;
|
|
20
|
-
_exports.useAuthState = useAuthState;
|
|
21
|
-
/**
|
|
22
|
-
* File: /src/state/index.ts
|
|
23
|
-
* Project: app
|
|
24
|
-
* File Created: 22-11-2022 17:40:53
|
|
25
|
-
* Author: Clay Risser
|
|
26
|
-
* -----
|
|
27
|
-
* Last Modified: 01-02-2023 14:38:51
|
|
28
|
-
* Modified By: Clay Risser
|
|
29
|
-
* -----
|
|
30
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
31
|
-
*
|
|
32
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
33
|
-
* you may not use this file except in compliance with the License.
|
|
34
|
-
* You may obtain a copy of the License at
|
|
35
|
-
*
|
|
36
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
37
|
-
*
|
|
38
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
39
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
40
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
41
|
-
* See the License for the specific language governing permissions and
|
|
42
|
-
* limitations under the License.
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
function useAuthState() {
|
|
46
|
-
return (0, _recoil.useRecoilState)(authState);
|
|
47
|
-
}
|
|
48
|
-
const authState = (0, _recoil.atom)({
|
|
49
|
-
key: "auth",
|
|
50
|
-
default: {},
|
|
51
|
-
effects: [_recoil2.persistAtom]
|
|
52
|
-
});
|
|
53
|
-
_exports.authState = authState;
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=index.js.map
|
package/lib/state/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useAuthState","useRecoilState","authState","atom","key","default","effects","persistAtom"],"sources":["../../src/state/index.ts"],"sourcesContent":["/**\n * File: /src/state/index.ts\n * Project: app\n * File Created: 22-11-2022 17:40:53\n * Author: Clay Risser\n * -----\n * Last Modified: 01-02-2023 14:38:51\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 { atom, useRecoilState } from \"recoil\";\nimport { persistAtom } from \"multiplatform.one/recoil\";\n\nexport function useAuthState() {\n return useRecoilState(authState);\n}\n\nexport const authState = atom<{ token?: string; refreshToken?: string }>({\n key: \"auth\",\n default: {},\n effects: [persistAtom],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAKO,SAASA,YAAY,GAAG;IAC7B,OAAO,IAAAC,sBAAc,EAACC,SAAS,CAAC;EAClC;EAEO,MAAMA,SAAS,GAAG,IAAAC,YAAI,EAA4C;IACvEC,GAAG,EAAE,MAAM;IACXC,OAAO,EAAE,CAAC,CAAC;IACXC,OAAO,EAAE,CAACC,oBAAW;EACvB,CAAC,CAAC;EAAC;AAAA"}
|