@multiplatform.one/keycloak 0.3.33 → 0.7.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/lib/index.js +34 -0
- package/package.json +34 -48
- package/src/@types/coreJsPure.d.ts +8 -8
- package/dist/esm/Authenticated.mjs +0 -40
- package/dist/esm/Authenticated.mjs.map +0 -7
- package/dist/esm/authConfig.mjs +0 -12
- package/dist/esm/authConfig.mjs.map +0 -7
- package/dist/esm/hooks/index.mjs +0 -7
- package/dist/esm/hooks/index.mjs.map +0 -7
- package/dist/esm/hooks/useAuthConfig.mjs +0 -9
- package/dist/esm/hooks/useAuthConfig.mjs.map +0 -7
- package/dist/esm/hooks/useCurrentRouteName/index.mjs +0 -17
- package/dist/esm/hooks/useCurrentRouteName/index.mjs.map +0 -7
- package/dist/esm/hooks/useCurrentRouteName/index.native.mjs +0 -12
- package/dist/esm/hooks/useCurrentRouteName/index.native.mjs.map +0 -7
- package/dist/esm/hooks/useKeycloak/index.mjs +0 -2
- package/dist/esm/hooks/useKeycloak/index.mjs.map +0 -7
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs +0 -527
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs.map +0 -7
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs +0 -108
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs.map +0 -7
- package/dist/esm/hooks/useLogin.mjs +0 -35
- package/dist/esm/hooks/useLogin.mjs.map +0 -7
- package/dist/esm/hooks/useTokensFromQuery/index.mjs +0 -12
- package/dist/esm/hooks/useTokensFromQuery/index.mjs.map +0 -7
- package/dist/esm/hooks/useTokensFromQuery/index.native.mjs +0 -7
- package/dist/esm/hooks/useTokensFromQuery/index.native.mjs.map +0 -7
- package/dist/esm/hooks/useTokensFromState.mjs +0 -10
- package/dist/esm/hooks/useTokensFromState.mjs.map +0 -7
- package/dist/esm/index.mjs +0 -5
- package/dist/esm/index.mjs.map +0 -7
- package/dist/esm/provider/afterAuth.mjs +0 -43
- package/dist/esm/provider/afterAuth.mjs.map +0 -7
- package/dist/esm/provider/index.mjs +0 -136
- package/dist/esm/provider/index.mjs.map +0 -7
- package/dist/esm/provider/keycloakProvider.mjs +0 -338
- package/dist/esm/provider/keycloakProvider.mjs.map +0 -7
- package/dist/esm/provider/keycloakProvider.native.mjs +0 -69
- package/dist/esm/provider/keycloakProvider.native.mjs.map +0 -7
- package/dist/esm/state/index.mjs +0 -16
- package/dist/esm/state/index.mjs.map +0 -7
- package/dist/esm/types.mjs +0 -5
- package/dist/esm/types.mjs.map +0 -7
- package/dist/esm/util.mjs +0 -26
- package/dist/esm/util.mjs.map +0 -7
- package/dist/jsx/Authenticated.mjs +0 -35
- package/dist/jsx/Authenticated.mjs.map +0 -7
- package/dist/jsx/authConfig.mjs +0 -12
- package/dist/jsx/authConfig.mjs.map +0 -7
- package/dist/jsx/hooks/index.mjs +0 -7
- package/dist/jsx/hooks/index.mjs.map +0 -7
- package/dist/jsx/hooks/useAuthConfig.mjs +0 -9
- package/dist/jsx/hooks/useAuthConfig.mjs.map +0 -7
- package/dist/jsx/hooks/useCurrentRouteName/index.mjs +0 -17
- package/dist/jsx/hooks/useCurrentRouteName/index.mjs.map +0 -7
- package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs +0 -12
- package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs.map +0 -7
- package/dist/jsx/hooks/useKeycloak/index.mjs +0 -2
- package/dist/jsx/hooks/useKeycloak/index.mjs.map +0 -7
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs +0 -76
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs.map +0 -7
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs +0 -58
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs.map +0 -7
- package/dist/jsx/hooks/useLogin.mjs +0 -33
- package/dist/jsx/hooks/useLogin.mjs.map +0 -7
- package/dist/jsx/hooks/useTokensFromQuery/index.mjs +0 -10
- package/dist/jsx/hooks/useTokensFromQuery/index.mjs.map +0 -7
- package/dist/jsx/hooks/useTokensFromQuery/index.native.mjs +0 -5
- package/dist/jsx/hooks/useTokensFromQuery/index.native.mjs.map +0 -7
- package/dist/jsx/hooks/useTokensFromState.mjs +0 -10
- package/dist/jsx/hooks/useTokensFromState.mjs.map +0 -7
- package/dist/jsx/index.mjs +0 -5
- package/dist/jsx/index.mjs.map +0 -7
- package/dist/jsx/provider/afterAuth.mjs +0 -42
- package/dist/jsx/provider/afterAuth.mjs.map +0 -7
- package/dist/jsx/provider/index.mjs +0 -61
- package/dist/jsx/provider/index.mjs.map +0 -7
- package/dist/jsx/provider/keycloakProvider.mjs +0 -247
- package/dist/jsx/provider/keycloakProvider.mjs.map +0 -7
- package/dist/jsx/provider/keycloakProvider.native.mjs +0 -14
- package/dist/jsx/provider/keycloakProvider.native.mjs.map +0 -7
- package/dist/jsx/state/index.mjs +0 -19
- package/dist/jsx/state/index.mjs.map +0 -7
- package/dist/jsx/types.mjs +0 -5
- package/dist/jsx/types.mjs.map +0 -7
- package/dist/jsx/util.mjs +0 -25
- package/dist/jsx/util.mjs.map +0 -7
- package/dist/lib/Authenticated.d.ts +0 -32
- package/dist/lib/Authenticated.js +0 -75
- package/dist/lib/Authenticated.js.map +0 -7
- package/dist/lib/authConfig.d.ts +0 -34
- package/dist/lib/authConfig.js +0 -37
- package/dist/lib/authConfig.js.map +0 -7
- package/dist/lib/hooks/index.d.ts +0 -29
- package/dist/lib/hooks/index.js +0 -33
- package/dist/lib/hooks/index.js.map +0 -7
- package/dist/lib/hooks/useAuthConfig.d.ts +0 -24
- package/dist/lib/hooks/useAuthConfig.js +0 -33
- package/dist/lib/hooks/useAuthConfig.js.map +0 -7
- package/dist/lib/hooks/useCurrentRouteName/index.d.ts +0 -24
- package/dist/lib/hooks/useCurrentRouteName/index.js +0 -41
- package/dist/lib/hooks/useCurrentRouteName/index.js.map +0 -7
- package/dist/lib/hooks/useCurrentRouteName/index.native.d.ts +0 -24
- package/dist/lib/hooks/useCurrentRouteName/index.native.js +0 -36
- package/dist/lib/hooks/useCurrentRouteName/index.native.js.map +0 -7
- package/dist/lib/hooks/useKeycloak/index.d.ts +0 -47
- package/dist/lib/hooks/useKeycloak/index.js +0 -23
- package/dist/lib/hooks/useKeycloak/index.js.map +0 -7
- package/dist/lib/hooks/useKeycloak/useKeycloak.d.ts +0 -42
- package/dist/lib/hooks/useKeycloak/useKeycloak.js +0 -111
- package/dist/lib/hooks/useKeycloak/useKeycloak.js.map +0 -7
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.d.ts +0 -40
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js +0 -93
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js.map +0 -7
- package/dist/lib/hooks/useLogin.d.ts +0 -24
- package/dist/lib/hooks/useLogin.js +0 -57
- package/dist/lib/hooks/useLogin.js.map +0 -7
- package/dist/lib/hooks/useTokensFromQuery/index.d.ts +0 -24
- package/dist/lib/hooks/useTokensFromQuery/index.js +0 -34
- package/dist/lib/hooks/useTokensFromQuery/index.js.map +0 -7
- package/dist/lib/hooks/useTokensFromQuery/index.native.d.ts +0 -24
- package/dist/lib/hooks/useTokensFromQuery/index.native.js +0 -29
- package/dist/lib/hooks/useTokensFromQuery/index.native.js.map +0 -7
- package/dist/lib/hooks/useTokensFromState.d.ts +0 -24
- package/dist/lib/hooks/useTokensFromState.js +0 -34
- package/dist/lib/hooks/useTokensFromState.js.map +0 -7
- package/dist/lib/index.d.ts +0 -27
- package/dist/lib/index.js +0 -29
- package/dist/lib/index.js.map +0 -7
- package/dist/lib/provider/afterAuth.d.ts +0 -28
- package/dist/lib/provider/afterAuth.js +0 -67
- package/dist/lib/provider/afterAuth.js.map +0 -7
- package/dist/lib/provider/index.d.ts +0 -38
- package/dist/lib/provider/index.js +0 -131
- package/dist/lib/provider/index.js.map +0 -7
- package/dist/lib/provider/keycloakProvider.d.ts +0 -41
- package/dist/lib/provider/keycloakProvider.js +0 -305
- package/dist/lib/provider/keycloakProvider.js.map +0 -7
- package/dist/lib/provider/keycloakProvider.native.d.ts +0 -26
- package/dist/lib/provider/keycloakProvider.native.js +0 -55
- package/dist/lib/provider/keycloakProvider.native.js.map +0 -7
- package/dist/lib/state/index.d.ts +0 -24
- package/dist/lib/state/index.js +0 -43
- package/dist/lib/state/index.js.map +0 -7
- package/dist/lib/tsconfig.build.tsbuildinfo +0 -1
- package/dist/lib/types.d.ts +0 -39
- package/dist/lib/types.js +0 -25
- package/dist/lib/types.js.map +0 -7
- package/dist/lib/util.d.ts +0 -25
- package/dist/lib/util.js +0 -51
- package/dist/lib/util.js.map +0 -7
package/dist/lib/hooks/index.js
DELETED
|
@@ -1,33 +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 hooks_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(hooks_exports);
|
|
18
|
-
__reExport(hooks_exports, require("./useAuthConfig"), module.exports);
|
|
19
|
-
__reExport(hooks_exports, require("./useCurrentRouteName"), module.exports);
|
|
20
|
-
__reExport(hooks_exports, require("./useKeycloak"), module.exports);
|
|
21
|
-
__reExport(hooks_exports, require("./useLogin"), module.exports);
|
|
22
|
-
__reExport(hooks_exports, require("./useTokensFromQuery"), module.exports);
|
|
23
|
-
__reExport(hooks_exports, require("./useTokensFromState"), module.exports);
|
|
24
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
-
0 && (module.exports = {
|
|
26
|
-
...require("./useAuthConfig"),
|
|
27
|
-
...require("./useCurrentRouteName"),
|
|
28
|
-
...require("./useKeycloak"),
|
|
29
|
-
...require("./useLogin"),
|
|
30
|
-
...require("./useTokensFromQuery"),
|
|
31
|
-
...require("./useTokensFromState")
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/index.ts\n * Project: app\n * File Created: 08-11-2022 06:34:56\n * Author: Clay Risser\n * -----\n * Last Modified: 26-05-2023 07:00: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\nexport * from './useAuthConfig';\nexport * from './useCurrentRouteName';\nexport * from './useKeycloak';\nexport * from './useLogin';\nexport * from './useTokensFromQuery';\nexport * from './useTokensFromState';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAwBA,0BAAc,4BAxBd;AAyBA,0BAAc,kCAzBd;AA0BA,0BAAc,0BA1Bd;AA2BA,0BAAc,uBA3Bd;AA4BA,0BAAc,iCA5Bd;AA6BA,0BAAc,iCA7Bd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useAuthConfig.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 09:20:41
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 25-11-2022 09:52:31
|
|
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 useAuthConfig(): import("../authConfig").AuthConfig;
|
|
@@ -1,33 +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 useAuthConfig_exports = {};
|
|
20
|
-
__export(useAuthConfig_exports, {
|
|
21
|
-
useAuthConfig: () => useAuthConfig
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useAuthConfig_exports);
|
|
24
|
-
var import_react = require("react");
|
|
25
|
-
var import_authConfig = require("../authConfig");
|
|
26
|
-
function useAuthConfig() {
|
|
27
|
-
return (0, import_react.useContext)(import_authConfig.AuthConfigContext);
|
|
28
|
-
}
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
useAuthConfig
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=useAuthConfig.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useAuthConfig.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useAuthConfig.ts\n * Project: app\n * File Created: 08-11-2022 09:20:41\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 09: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 { useContext } from 'react';\nimport { AuthConfigContext } from '../authConfig';\n\nexport function useAuthConfig() {\n return useContext(AuthConfigContext);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,mBAA2B;AAC3B,wBAAkC;AAE3B,SAAS,gBAAgB;AAC9B,aAAO,yBAAW,mCAAiB;AACrC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useCurrentRouteName/index.ts
|
|
3
|
-
* Project: @multiplatform.one/keycloak
|
|
4
|
-
* File Created: 24-02-2023 06:30:32
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 24-02-2023 06:30:54
|
|
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 useCurrentRouteName(): string | null;
|
|
@@ -1,41 +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 useCurrentRouteName_exports = {};
|
|
20
|
-
__export(useCurrentRouteName_exports, {
|
|
21
|
-
useCurrentRouteName: () => useCurrentRouteName
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useCurrentRouteName_exports);
|
|
24
|
-
var import_multiplatform = require("multiplatform.one");
|
|
25
|
-
var import_native = require("@react-navigation/native");
|
|
26
|
-
var import_router = require("next/router");
|
|
27
|
-
function useCurrentRouteName() {
|
|
28
|
-
if (import_multiplatform.MultiPlatform.isStorybook)
|
|
29
|
-
return null;
|
|
30
|
-
if (import_multiplatform.MultiPlatform.isNext) {
|
|
31
|
-
const router = (0, import_router.useRouter)();
|
|
32
|
-
return router.route;
|
|
33
|
-
}
|
|
34
|
-
const route = (0, import_native.useRoute)();
|
|
35
|
-
return route.name;
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
useCurrentRouteName
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useCurrentRouteName/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useCurrentRouteName/index.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 24-02-2023 06:30:32\n * Author: Clay Risser\n * -----\n * Last Modified: 24-02-2023 06:30:54\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 { useRoute } from '@react-navigation/native';\nimport { useRouter } from 'next/router';\n\nexport function useCurrentRouteName() {\n if (MultiPlatform.isStorybook) return null;\n if (MultiPlatform.isNext) {\n const router = useRouter();\n return router.route;\n }\n const route = useRoute();\n return route.name;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,2BAA8B;AAC9B,oBAAyB;AACzB,oBAA0B;AAEnB,SAAS,sBAAsB;AACpC,MAAI,mCAAc;AAAa,WAAO;AACtC,MAAI,mCAAc,QAAQ;AACxB,UAAM,aAAS,yBAAU;AACzB,WAAO,OAAO;AAAA,EAChB;AACA,QAAM,YAAQ,wBAAS;AACvB,SAAO,MAAM;AACf;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useCurrentRouteName/index.native.ts
|
|
3
|
-
* Project: @multiplatform.one/keycloak
|
|
4
|
-
* File Created: 24-02-2023 06:30:36
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 24-02-2023 06:31:25
|
|
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 useCurrentRouteName(): string | null;
|
|
@@ -1,36 +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
|
-
useCurrentRouteName: () => useCurrentRouteName
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(index_native_exports);
|
|
24
|
-
var import_multiplatform = require("multiplatform.one");
|
|
25
|
-
var import_native = require("@react-navigation/native");
|
|
26
|
-
function useCurrentRouteName() {
|
|
27
|
-
if (import_multiplatform.MultiPlatform.isStorybook)
|
|
28
|
-
return null;
|
|
29
|
-
const route = (0, import_native.useRoute)();
|
|
30
|
-
return route.name;
|
|
31
|
-
}
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
useCurrentRouteName
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useCurrentRouteName/index.native.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useCurrentRouteName/index.native.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 24-02-2023 06:30:36\n * Author: Clay Risser\n * -----\n * Last Modified: 24-02-2023 06:31:25\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 { useRoute } from '@react-navigation/native';\n\nexport function useCurrentRouteName() {\n if (MultiPlatform.isStorybook) return null;\n const route = useRoute();\n return route.name;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,2BAA8B;AAC9B,oBAAyB;AAElB,SAAS,sBAAsB;AACpC,MAAI,mCAAc;AAAa,WAAO;AACtC,QAAM,YAAQ,wBAAS;AACvB,SAAO,MAAM;AACf;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useKeycloak/index.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 14:10:44
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 01-06-2023 13:55:42
|
|
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 { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';
|
|
25
|
-
export * from './useKeycloak';
|
|
26
|
-
export interface IKeycloak {
|
|
27
|
-
authenticated?: boolean;
|
|
28
|
-
idToken?: string;
|
|
29
|
-
realmAccess?: KeycloakRoles;
|
|
30
|
-
refreshToken?: string;
|
|
31
|
-
refreshTokenParsed?: KeycloakTokenParsed;
|
|
32
|
-
resourceAccess?: KeycloakResourceAccess;
|
|
33
|
-
subject?: string;
|
|
34
|
-
token?: string;
|
|
35
|
-
tokenParsed?: ITokenParsed;
|
|
36
|
-
email?: string;
|
|
37
|
-
username?: string;
|
|
38
|
-
login: () => Promise<unknown>;
|
|
39
|
-
logout: () => Promise<unknown>;
|
|
40
|
-
}
|
|
41
|
-
export interface ITokenParsed extends KeycloakTokenParsed {
|
|
42
|
-
'allowed-origins'?: string[];
|
|
43
|
-
email_verified?: boolean;
|
|
44
|
-
preferred_username?: string;
|
|
45
|
-
scope?: string;
|
|
46
|
-
sid?: string;
|
|
47
|
-
}
|
|
@@ -1,23 +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 useKeycloak_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(useKeycloak_exports);
|
|
18
|
-
__reExport(useKeycloak_exports, require("./useKeycloak"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./useKeycloak")
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useKeycloak/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/index.ts\n * Project: app\n * File Created: 08-11-2022 14:10:44\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 13:55:42\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 type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';\nexport * from './useKeycloak';\n\nexport interface IKeycloak {\n authenticated?: boolean;\n idToken?: string;\n realmAccess?: KeycloakRoles;\n refreshToken?: string;\n refreshTokenParsed?: KeycloakTokenParsed;\n resourceAccess?: KeycloakResourceAccess;\n subject?: string;\n token?: string;\n tokenParsed?: ITokenParsed;\n email?: string;\n username?: string;\n login: () => Promise<unknown>;\n logout: () => Promise<unknown>;\n}\n\nexport interface ITokenParsed extends KeycloakTokenParsed {\n 'allowed-origins'?: string[];\n email_verified?: boolean;\n preferred_username?: string;\n scope?: string;\n sid?: string;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAyBA,gCAAc,0BAzBd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useKeycloak/useKeycloak.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 06:04:59
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 01-06-2023 14:02:40
|
|
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 { IKeycloak } from './index';
|
|
25
|
-
export declare function useKeycloak(): Keycloak;
|
|
26
|
-
export declare class Keycloak implements IKeycloak {
|
|
27
|
-
private readonly keycloak;
|
|
28
|
-
authenticated?: boolean;
|
|
29
|
-
constructor(keycloak: IKeycloak | undefined, initialized: boolean);
|
|
30
|
-
get idToken(): string | undefined;
|
|
31
|
-
get realmAccess(): import("@bitspur/keycloak-js").KeycloakRoles | undefined;
|
|
32
|
-
get refreshToken(): string | undefined;
|
|
33
|
-
get refreshTokenParsed(): import("@bitspur/keycloak-js").KeycloakTokenParsed | undefined;
|
|
34
|
-
get resourceAccess(): import("@bitspur/keycloak-js").KeycloakResourceAccess | undefined;
|
|
35
|
-
get subject(): string | undefined;
|
|
36
|
-
get token(): string | undefined;
|
|
37
|
-
get tokenParsed(): import("./index").ITokenParsed | undefined;
|
|
38
|
-
get email(): any;
|
|
39
|
-
get username(): string | undefined;
|
|
40
|
-
login(): Promise<unknown>;
|
|
41
|
-
logout(): Promise<unknown>;
|
|
42
|
-
}
|
|
@@ -1,111 +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 useKeycloak_exports = {};
|
|
20
|
-
__export(useKeycloak_exports, {
|
|
21
|
-
Keycloak: () => Keycloak,
|
|
22
|
-
useKeycloak: () => useKeycloak
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useKeycloak_exports);
|
|
25
|
-
var import_multiplatform = require("multiplatform.one");
|
|
26
|
-
var import_useAuthConfig = require("../useAuthConfig");
|
|
27
|
-
var import_react_keycloak_web = require("@bitspur/react-keycloak-web");
|
|
28
|
-
var import_react_keycloak_ssr = require("@bitspur/react-keycloak-ssr");
|
|
29
|
-
function useKeycloak() {
|
|
30
|
-
const authConfig = (0, import_useAuthConfig.useAuthConfig)();
|
|
31
|
-
if (import_multiplatform.MultiPlatform.isStorybook) {
|
|
32
|
-
return new Keycloak(
|
|
33
|
-
{
|
|
34
|
-
email: "storybook@example.com",
|
|
35
|
-
login: async () => void 0,
|
|
36
|
-
logout: async () => void 0,
|
|
37
|
-
subject: "0",
|
|
38
|
-
username: "storybook"
|
|
39
|
-
},
|
|
40
|
-
true
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
if (import_multiplatform.MultiPlatform.isNext && authConfig.ssr) {
|
|
44
|
-
const { keycloak: keycloak2, initialized: initialized2 } = (0, import_react_keycloak_ssr.useKeycloak)();
|
|
45
|
-
return new Keycloak(keycloak2, initialized2);
|
|
46
|
-
}
|
|
47
|
-
const { keycloak, initialized } = (0, import_react_keycloak_web.useKeycloak)();
|
|
48
|
-
return new Keycloak(keycloak, initialized);
|
|
49
|
-
}
|
|
50
|
-
class Keycloak {
|
|
51
|
-
constructor(keycloak, initialized) {
|
|
52
|
-
this.keycloak = keycloak;
|
|
53
|
-
this.authenticated = initialized ? keycloak == null ? void 0 : keycloak.authenticated : void 0;
|
|
54
|
-
}
|
|
55
|
-
get idToken() {
|
|
56
|
-
var _a;
|
|
57
|
-
return (_a = this.keycloak) == null ? void 0 : _a.idToken;
|
|
58
|
-
}
|
|
59
|
-
get realmAccess() {
|
|
60
|
-
var _a;
|
|
61
|
-
return (_a = this.keycloak) == null ? void 0 : _a.realmAccess;
|
|
62
|
-
}
|
|
63
|
-
get refreshToken() {
|
|
64
|
-
var _a;
|
|
65
|
-
return (_a = this.keycloak) == null ? void 0 : _a.refreshToken;
|
|
66
|
-
}
|
|
67
|
-
get refreshTokenParsed() {
|
|
68
|
-
var _a;
|
|
69
|
-
return (_a = this.keycloak) == null ? void 0 : _a.refreshTokenParsed;
|
|
70
|
-
}
|
|
71
|
-
get resourceAccess() {
|
|
72
|
-
var _a;
|
|
73
|
-
return (_a = this.keycloak) == null ? void 0 : _a.resourceAccess;
|
|
74
|
-
}
|
|
75
|
-
get subject() {
|
|
76
|
-
var _a;
|
|
77
|
-
return (_a = this.keycloak) == null ? void 0 : _a.subject;
|
|
78
|
-
}
|
|
79
|
-
get token() {
|
|
80
|
-
var _a;
|
|
81
|
-
return (_a = this.keycloak) == null ? void 0 : _a.token;
|
|
82
|
-
}
|
|
83
|
-
get tokenParsed() {
|
|
84
|
-
var _a;
|
|
85
|
-
return (_a = this.keycloak) == null ? void 0 : _a.tokenParsed;
|
|
86
|
-
}
|
|
87
|
-
get email() {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
return (_b = (_a = this.keycloak) == null ? void 0 : _a.tokenParsed) == null ? void 0 : _b.email;
|
|
90
|
-
}
|
|
91
|
-
get username() {
|
|
92
|
-
var _a, _b;
|
|
93
|
-
return (_b = (_a = this.keycloak) == null ? void 0 : _a.tokenParsed) == null ? void 0 : _b.preferred_username;
|
|
94
|
-
}
|
|
95
|
-
async login() {
|
|
96
|
-
if (!this.keycloak)
|
|
97
|
-
return;
|
|
98
|
-
return this.keycloak.login();
|
|
99
|
-
}
|
|
100
|
-
async logout() {
|
|
101
|
-
if (!this.keycloak)
|
|
102
|
-
return;
|
|
103
|
-
return this.keycloak.logout();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
-
0 && (module.exports = {
|
|
108
|
-
Keycloak,
|
|
109
|
-
useKeycloak
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=useKeycloak.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:02:40\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 type { IKeycloak } from './index';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from '../useAuthConfig';\nimport { useKeycloak as useReactKeycloak } from '@bitspur/react-keycloak-web';\nimport { useKeycloak as useSsrKeycloak } from '@bitspur/react-keycloak-ssr';\n\nexport function useKeycloak() {\n const authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) {\n return new Keycloak(\n {\n email: 'storybook@example.com',\n login: async () => undefined,\n logout: async () => undefined,\n subject: '0',\n username: 'storybook',\n },\n true,\n );\n }\n if (MultiPlatform.isNext && authConfig.ssr) {\n const { keycloak, initialized } = useSsrKeycloak();\n return new Keycloak(keycloak, initialized);\n }\n const { keycloak, initialized } = useReactKeycloak();\n return new Keycloak(keycloak, initialized);\n}\n\nexport class Keycloak implements IKeycloak {\n authenticated?: boolean;\n\n constructor(private readonly keycloak: IKeycloak | undefined, initialized: boolean) {\n this.authenticated = initialized ? keycloak?.authenticated : undefined;\n }\n\n get idToken() {\n return this.keycloak?.idToken;\n }\n\n get realmAccess() {\n return this.keycloak?.realmAccess;\n }\n\n get refreshToken() {\n return this.keycloak?.refreshToken;\n }\n\n get refreshTokenParsed() {\n return this.keycloak?.refreshTokenParsed;\n }\n\n get resourceAccess() {\n return this.keycloak?.resourceAccess;\n }\n\n get subject() {\n return this.keycloak?.subject;\n }\n\n get token() {\n return this.keycloak?.token;\n }\n\n get tokenParsed() {\n return this.keycloak?.tokenParsed;\n }\n\n get email() {\n return this.keycloak?.tokenParsed?.email;\n }\n\n get username() {\n return this.keycloak?.tokenParsed?.preferred_username;\n }\n\n async login() {\n if (!this.keycloak) return;\n return this.keycloak.login();\n }\n\n async logout() {\n if (!this.keycloak) return;\n return this.keycloak.logout();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBA,2BAA8B;AAC9B,2BAA8B;AAC9B,gCAAgD;AAChD,gCAA8C;AAEvC,SAAS,cAAc;AAC5B,QAAM,iBAAa,oCAAc;AACjC,MAAI,mCAAc,aAAa;AAC7B,WAAO,IAAI;AAAA,MACT;AAAA,QACE,OAAO;AAAA,QACP,OAAO,YAAY;AAAA,QACnB,QAAQ,YAAY;AAAA,QACpB,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,mCAAc,UAAU,WAAW,KAAK;AAC1C,UAAM,EAAE,UAAAA,WAAU,aAAAC,aAAY,QAAI,0BAAAC,aAAe;AACjD,WAAO,IAAI,SAASF,WAAUC,YAAW;AAAA,EAC3C;AACA,QAAM,EAAE,UAAU,YAAY,QAAI,0BAAAE,aAAiB;AACnD,SAAO,IAAI,SAAS,UAAU,WAAW;AAC3C;AAEO,MAAM,SAA8B;AAAA,EAGzC,YAA6B,UAAiC,aAAsB;AAAvD;AAC3B,SAAK,gBAAgB,cAAc,qCAAU,gBAAgB;AAAA,EAC/D;AAAA,EAEA,IAAI,UAAU;AA3DhB;AA4DI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,cAAc;AA/DpB;AAgEI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,eAAe;AAnErB;AAoEI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,qBAAqB;AAvE3B;AAwEI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,iBAAiB;AA3EvB;AA4EI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,UAAU;AA/EhB;AAgFI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,QAAQ;AAnFd;AAoFI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,cAAc;AAvFpB;AAwFI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,QAAQ;AA3Fd;AA4FI,YAAO,gBAAK,aAAL,mBAAe,gBAAf,mBAA4B;AAAA,EACrC;AAAA,EAEA,IAAI,WAAW;AA/FjB;AAgGI,YAAO,gBAAK,aAAL,mBAAe,gBAAf,mBAA4B;AAAA,EACrC;AAAA,EAEA,MAAM,QAAQ;AACZ,QAAI,CAAC,KAAK;AAAU;AACpB,WAAO,KAAK,SAAS,MAAM;AAAA,EAC7B;AAAA,EAEA,MAAM,SAAS;AACb,QAAI,CAAC,KAAK;AAAU;AACpB,WAAO,KAAK,SAAS,OAAO;AAAA,EAC9B;AACF;",
|
|
6
|
-
"names": ["keycloak", "initialized", "useSsrKeycloak", "useReactKeycloak"]
|
|
7
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useKeycloak/useKeycloak.native.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 14:10:25
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 01-06-2023 14:04:46
|
|
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 { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';
|
|
25
|
-
import type { IKeycloak } from './index';
|
|
26
|
-
import type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';
|
|
27
|
-
export declare function useKeycloak(): IKeycloak;
|
|
28
|
-
export declare class ExpoKeycloak implements IKeycloak {
|
|
29
|
-
logout: () => Promise<unknown>;
|
|
30
|
-
token?: string | undefined;
|
|
31
|
-
refreshToken?: string | undefined;
|
|
32
|
-
authenticated?: boolean;
|
|
33
|
-
tokenParsed?: KeycloakTokenParsed;
|
|
34
|
-
refreshTokenParsed?: KeycloakTokenParsed;
|
|
35
|
-
subject?: string;
|
|
36
|
-
realmAccess?: KeycloakRoles;
|
|
37
|
-
resourceAccess?: KeycloakResourceAccess;
|
|
38
|
-
login: () => Promise<unknown>;
|
|
39
|
-
constructor(ready: boolean, isLoggedIn: boolean | undefined, login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>, logout: () => Promise<unknown>, token?: string | undefined, refreshToken?: string | undefined);
|
|
40
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var useKeycloak_native_exports = {};
|
|
30
|
-
__export(useKeycloak_native_exports, {
|
|
31
|
-
ExpoKeycloak: () => ExpoKeycloak,
|
|
32
|
-
useKeycloak: () => useKeycloak
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(useKeycloak_native_exports);
|
|
35
|
-
var import_atob = __toESM(require("core-js-pure/stable/atob"));
|
|
36
|
-
var import_escape = __toESM(require("core-js-pure/stable/escape"));
|
|
37
|
-
var import_multiplatform = require("multiplatform.one");
|
|
38
|
-
var import_expo_keycloak_auth = require("expo-keycloak-auth");
|
|
39
|
-
function useKeycloak() {
|
|
40
|
-
if (import_multiplatform.MultiPlatform.isStorybook)
|
|
41
|
-
return { authenticated: true };
|
|
42
|
-
const { ready, login, isLoggedIn, token, logout, refreshToken } = (0, import_expo_keycloak_auth.useKeycloak)();
|
|
43
|
-
const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || void 0, refreshToken || void 0);
|
|
44
|
-
return keycloak;
|
|
45
|
-
}
|
|
46
|
-
class ExpoKeycloak {
|
|
47
|
-
constructor(ready, isLoggedIn, login, logout, token, refreshToken) {
|
|
48
|
-
this.logout = logout;
|
|
49
|
-
this.token = token;
|
|
50
|
-
this.refreshToken = refreshToken;
|
|
51
|
-
if (ready)
|
|
52
|
-
this.authenticated = isLoggedIn;
|
|
53
|
-
if (this.authenticated) {
|
|
54
|
-
if (this.token)
|
|
55
|
-
this.tokenParsed = decodeToken(this.token);
|
|
56
|
-
if (this.refreshToken) {
|
|
57
|
-
this.refreshTokenParsed = decodeToken(this.refreshToken);
|
|
58
|
-
}
|
|
59
|
-
if (this.tokenParsed) {
|
|
60
|
-
this.subject = this.tokenParsed.sub;
|
|
61
|
-
this.realmAccess = this.tokenParsed.realm_access;
|
|
62
|
-
this.resourceAccess = this.tokenParsed.resource_access;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
this.login = () => login();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function decodeToken(str) {
|
|
69
|
-
str = str.split(".")[1];
|
|
70
|
-
str = str.replace(/-/g, "+");
|
|
71
|
-
str = str.replace(/_/g, "/");
|
|
72
|
-
switch (str.length % 4) {
|
|
73
|
-
case 0:
|
|
74
|
-
break;
|
|
75
|
-
case 2:
|
|
76
|
-
str += "==";
|
|
77
|
-
break;
|
|
78
|
-
case 3:
|
|
79
|
-
str += "=";
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
throw "Invalid token";
|
|
83
|
-
}
|
|
84
|
-
str = decodeURIComponent((0, import_escape.default)((0, import_atob.default)(str)));
|
|
85
|
-
str = JSON.parse(str);
|
|
86
|
-
return str;
|
|
87
|
-
}
|
|
88
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
-
0 && (module.exports = {
|
|
90
|
-
ExpoKeycloak,
|
|
91
|
-
useKeycloak
|
|
92
|
-
});
|
|
93
|
-
//# sourceMappingURL=useKeycloak.native.js.map
|