@multiplatform.one/keycloak 0.3.33 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +34 -0
- package/package.json +32 -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
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.native.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:04: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 atob from 'core-js-pure/stable/atob';\nimport escape from 'core-js-pure/stable/escape';\nimport type { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';\nimport type { IKeycloak } from './index';\nimport type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useKeycloak as useExpoKeycloak } from 'expo-keycloak-auth';\n\nexport function useKeycloak() {\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n const { ready, login, isLoggedIn, token, logout, refreshToken } = useExpoKeycloak();\n const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);\n return keycloak as IKeycloak;\n}\n\nexport class ExpoKeycloak implements IKeycloak {\n authenticated?: boolean;\n\n tokenParsed?: KeycloakTokenParsed;\n\n refreshTokenParsed?: KeycloakTokenParsed;\n\n subject?: string;\n\n realmAccess?: KeycloakRoles;\n\n resourceAccess?: KeycloakResourceAccess;\n\n login: () => Promise<unknown>;\n\n constructor(\n ready: boolean,\n isLoggedIn: boolean | undefined,\n login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>,\n public logout: () => Promise<unknown>,\n public token?: string,\n public refreshToken?: string,\n ) {\n if (ready) this.authenticated = isLoggedIn;\n if (this.authenticated) {\n if (this.token) this.tokenParsed = decodeToken(this.token);\n if (this.refreshToken) {\n this.refreshTokenParsed = decodeToken(this.refreshToken);\n }\n if (this.tokenParsed) {\n this.subject = this.tokenParsed.sub;\n this.realmAccess = this.tokenParsed.realm_access;\n this.resourceAccess = this.tokenParsed.resource_access;\n }\n }\n this.login = () => login();\n }\n}\n\nfunction decodeToken(str: string) {\n str = str.split('.')[1];\n str = str.replace(/-/g, '+');\n str = str.replace(/_/g, '/');\n switch (str.length % 4) {\n case 0:\n break;\n case 2:\n str += '==';\n break;\n case 3:\n str += '=';\n break;\n default:\n throw 'Invalid token';\n }\n str = decodeURIComponent(escape(atob(str)));\n str = JSON.parse(str);\n return str as unknown as KeycloakTokenParsed;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,kBAAiB;AACjB,oBAAmB;AAInB,2BAA8B;AAC9B,gCAA+C;AAExC,SAAS,cAAc;AAC5B,MAAI,mCAAc;AAAa,WAAO,EAAE,eAAe,KAAK;AAC5D,QAAM,EAAE,OAAO,OAAO,YAAY,OAAO,QAAQ,aAAa,QAAI,0BAAAA,aAAgB;AAClF,QAAM,WAAW,IAAI,aAAa,OAAO,YAAY,OAAO,QAAQ,SAAS,QAAW,gBAAgB,MAAS;AACjH,SAAO;AACT;AAEO,MAAM,aAAkC;AAAA,EAe7C,YACE,OACA,YACA,OACO,QACA,OACA,cACP;AAHO;AACA;AACA;AAEP,QAAI;AAAO,WAAK,gBAAgB;AAChC,QAAI,KAAK,eAAe;AACtB,UAAI,KAAK;AAAO,aAAK,cAAc,YAAY,KAAK,KAAK;AACzD,UAAI,KAAK,cAAc;AACrB,aAAK,qBAAqB,YAAY,KAAK,YAAY;AAAA,MACzD;AACA,UAAI,KAAK,aAAa;AACpB,aAAK,UAAU,KAAK,YAAY;AAChC,aAAK,cAAc,KAAK,YAAY;AACpC,aAAK,iBAAiB,KAAK,YAAY;AAAA,MACzC;AAAA,IACF;AACA,SAAK,QAAQ,MAAM,MAAM;AAAA,EAC3B;AACF;AAEA,SAAS,YAAY,KAAa;AAChC,QAAM,IAAI,MAAM,GAAG,EAAE,CAAC;AACtB,QAAM,IAAI,QAAQ,MAAM,GAAG;AAC3B,QAAM,IAAI,QAAQ,MAAM,GAAG;AAC3B,UAAQ,IAAI,SAAS,GAAG;AAAA,IACtB,KAAK;AACH;AAAA,IACF,KAAK;AACH,aAAO;AACP;AAAA,IACF,KAAK;AACH,aAAO;AACP;AAAA,IACF;AACE,YAAM;AAAA,EACV;AACA,QAAM,uBAAmB,cAAAC,aAAO,YAAAC,SAAK,GAAG,CAAC,CAAC;AAC1C,QAAM,KAAK,MAAM,GAAG;AACpB,SAAO;AACT;",
|
|
6
|
-
"names": ["useExpoKeycloak", "escape", "atob"]
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useLogin.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 08:49:14
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 25-04-2023 23:09:10
|
|
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 useLogin(loginRoute?: string): () => void;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useLogin_exports = {};
|
|
20
|
-
__export(useLogin_exports, {
|
|
21
|
-
useLogin: () => useLogin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useLogin_exports);
|
|
24
|
-
var import_multiplatform = require("multiplatform.one");
|
|
25
|
-
var import_useAuthConfig = require("./useAuthConfig");
|
|
26
|
-
var import_useCurrentRouteName = require("./useCurrentRouteName");
|
|
27
|
-
var import_useKeycloak = require("./useKeycloak/useKeycloak");
|
|
28
|
-
var import_router = require("solito/router");
|
|
29
|
-
function useLogin(loginRoute) {
|
|
30
|
-
if (import_multiplatform.MultiPlatform.isStorybook)
|
|
31
|
-
return () => null;
|
|
32
|
-
const keycloak = (0, import_useKeycloak.useKeycloak)();
|
|
33
|
-
const authConfig = (0, import_useAuthConfig.useAuthConfig)();
|
|
34
|
-
const currentRouteName = (0, import_useCurrentRouteName.useCurrentRouteName)();
|
|
35
|
-
const router = (0, import_router.useRouter)();
|
|
36
|
-
return () => {
|
|
37
|
-
if (!loginRoute)
|
|
38
|
-
loginRoute = authConfig.loginRoute;
|
|
39
|
-
if (!loginRoute) {
|
|
40
|
-
keycloak.login();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const url = new URL("x://".concat(loginRoute));
|
|
44
|
-
const searchParams = new URLSearchParams(url.search);
|
|
45
|
-
if (currentRouteName)
|
|
46
|
-
searchParams.append("backTo", currentRouteName);
|
|
47
|
-
let query = searchParams.toString();
|
|
48
|
-
if (query.length)
|
|
49
|
-
query = "?".concat(query);
|
|
50
|
-
router.push("".concat(url.pathname.substring(2)).concat(query));
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
useLogin
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=useLogin.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useLogin.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useLogin.ts\n * Project: app\n * File Created: 08-11-2022 08:49:14\n * Author: Clay Risser\n * -----\n * Last Modified: 25-04-2023 23:09:10\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from './useAuthConfig';\nimport { useCurrentRouteName } from './useCurrentRouteName';\nimport { useKeycloak } from './useKeycloak/useKeycloak';\nimport { useRouter } from 'solito/router';\n\nexport function useLogin(loginRoute?: string) {\n if (MultiPlatform.isStorybook) return () => null;\n const keycloak = useKeycloak();\n const authConfig = useAuthConfig();\n const currentRouteName = useCurrentRouteName();\n const router = useRouter();\n return () => {\n if (!loginRoute) loginRoute = authConfig.loginRoute;\n if (!loginRoute) {\n keycloak.login();\n return;\n }\n const url = new URL(`x://${loginRoute}`);\n const searchParams = new URLSearchParams(url.search);\n if (currentRouteName) searchParams.append('backTo', currentRouteName);\n let query = searchParams.toString();\n if (query.length) query = `?${query}`;\n router.push(`${url.pathname.substring(2)}${query}`);\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,2BAA8B;AAC9B,2BAA8B;AAC9B,iCAAoC;AACpC,yBAA4B;AAC5B,oBAA0B;AAEnB,SAAS,SAAS,YAAqB;AAC5C,MAAI,mCAAc;AAAa,WAAO,MAAM;AAC5C,QAAM,eAAW,gCAAY;AAC7B,QAAM,iBAAa,oCAAc;AACjC,QAAM,uBAAmB,gDAAoB;AAC7C,QAAM,aAAS,yBAAU;AACzB,SAAO,MAAM;AACX,QAAI,CAAC;AAAY,mBAAa,WAAW;AACzC,QAAI,CAAC,YAAY;AACf,eAAS,MAAM;AACf;AAAA,IACF;AACA,UAAM,MAAM,IAAI,IAAI,OAAO,kBAAY;AACvC,UAAM,eAAe,IAAI,gBAAgB,IAAI,MAAM;AACnD,QAAI;AAAkB,mBAAa,OAAO,UAAU,gBAAgB;AACpE,QAAI,QAAQ,aAAa,SAAS;AAClC,QAAI,MAAM;AAAQ,cAAQ,IAAI;AAC9B,WAAO,KAAK,GAAG,WAAI,SAAS,UAAU,CAAC,GAAI,aAAO;AAAA,EACpD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useTokensFromQuery/index.ts
|
|
3
|
-
* Project: @multiplatform.one/keycloak
|
|
4
|
-
* File Created: 15-05-2023 01:54:44
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 16-05-2023 07:40:41
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2022 - 2023
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
export declare function useTokensFromQuery(): boolean;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useTokensFromQuery_exports = {};
|
|
20
|
-
__export(useTokensFromQuery_exports, {
|
|
21
|
-
useTokensFromQuery: () => useTokensFromQuery
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useTokensFromQuery_exports);
|
|
24
|
-
var import_multiplatform = require("multiplatform.one");
|
|
25
|
-
var import_router = require("next/router");
|
|
26
|
-
function useTokensFromQuery() {
|
|
27
|
-
const { query } = import_multiplatform.MultiPlatform.isNext ? (0, import_router.useRouter)() : { query: {} };
|
|
28
|
-
return "idToken" in query || "token" in query || "refreshToken" in query;
|
|
29
|
-
}
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
useTokensFromQuery
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useTokensFromQuery/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useTokensFromQuery/index.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 15-05-2023 01:54:44\n * Author: Clay Risser\n * -----\n * Last Modified: 16-05-2023 07:40:41\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022 - 2023\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useRouter } from 'next/router';\n\nexport function useTokensFromQuery() {\n const { query } = MultiPlatform.isNext ? useRouter() : { query: {} };\n return 'idToken' in query || 'token' in query || 'refreshToken' in query;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,2BAA8B;AAC9B,oBAA0B;AAEnB,SAAS,qBAAqB;AACnC,QAAM,EAAE,MAAM,IAAI,mCAAc,aAAS,yBAAU,IAAI,EAAE,OAAO,CAAC,EAAE;AACnE,SAAO,aAAa,SAAS,WAAW,SAAS,kBAAkB;AACrE;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useTokensFromQuery/index.native.ts
|
|
3
|
-
* Project: @multiplatform.one/keycloak
|
|
4
|
-
* File Created: 15-05-2023 01:54:48
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 16-05-2023 07:40:46
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2022 - 2023
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
export declare const useTokensFromQuery: () => boolean;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var index_native_exports = {};
|
|
20
|
-
__export(index_native_exports, {
|
|
21
|
-
useTokensFromQuery: () => useTokensFromQuery
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(index_native_exports);
|
|
24
|
-
const useTokensFromQuery = () => false;
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
useTokensFromQuery
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/useTokensFromQuery/index.native.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useTokensFromQuery/index.native.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 15-05-2023 01:54:48\n * Author: Clay Risser\n * -----\n * Last Modified: 16-05-2023 07:40:46\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022 - 2023\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const useTokensFromQuery = () => false;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBO,MAAM,qBAAqB,MAAM;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useTokensFromState.ts
|
|
3
|
-
* Project: @multiplatform.one/keycloak
|
|
4
|
-
* File Created: 16-05-2023 06:29:02
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 16-05-2023 07:40:36
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2022 - 2023
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
export declare function useTokensFromState(): boolean;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useTokensFromState_exports = {};
|
|
20
|
-
__export(useTokensFromState_exports, {
|
|
21
|
-
useTokensFromState: () => useTokensFromState
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useTokensFromState_exports);
|
|
24
|
-
var import_state = require("../state");
|
|
25
|
-
var import_util = require("../util");
|
|
26
|
-
function useTokensFromState() {
|
|
27
|
-
const authState = (0, import_state.useAuthState)();
|
|
28
|
-
return !!(0, import_util.validToken)(authState.token, authState.refreshToken);
|
|
29
|
-
}
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
useTokensFromState
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=useTokensFromState.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useTokensFromState.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useTokensFromState.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 16-05-2023 06:29:02\n * Author: Clay Risser\n * -----\n * Last Modified: 16-05-2023 07:40:36\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022 - 2023\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useAuthState } from '../state';\nimport { validToken } from '../util';\n\nexport function useTokensFromState() {\n const authState = useAuthState();\n return !!validToken(authState.token, authState.refreshToken);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,mBAA6B;AAC7B,kBAA2B;AAEpB,SAAS,qBAAqB;AACnC,QAAM,gBAAY,2BAAa;AAC/B,SAAO,CAAC,KAAC,wBAAW,UAAU,OAAO,UAAU,YAAY;AAC7D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/lib/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/index.ts
|
|
3
|
-
* Project: @multiplatform.one/keycloak
|
|
4
|
-
* File Created: 25-11-2022 09:51:55
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 25-11-2022 09:52:06
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2022
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
export * from './Authenticated';
|
|
25
|
-
export * from './authConfig';
|
|
26
|
-
export * from './hooks';
|
|
27
|
-
export * from './provider';
|
package/dist/lib/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(src_exports);
|
|
18
|
-
__reExport(src_exports, require("./Authenticated"), module.exports);
|
|
19
|
-
__reExport(src_exports, require("./authConfig"), module.exports);
|
|
20
|
-
__reExport(src_exports, require("./hooks"), module.exports);
|
|
21
|
-
__reExport(src_exports, require("./provider"), module.exports);
|
|
22
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
-
0 && (module.exports = {
|
|
24
|
-
...require("./Authenticated"),
|
|
25
|
-
...require("./authConfig"),
|
|
26
|
-
...require("./hooks"),
|
|
27
|
-
...require("./provider")
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/index.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 25-11-2022 09:51:55\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 09:52:06\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './Authenticated';\nexport * from './authConfig';\nexport * from './hooks';\nexport * from './provider';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAwBA,wBAAc,4BAxBd;AAyBA,wBAAc,yBAzBd;AA0BA,wBAAc,oBA1Bd;AA2BA,wBAAc,uBA3Bd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /auth/provider/afterAuth.tsx
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 22-11-2022 17:49:58
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 22-11-2022 18:00:39
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
import type { FC, ReactNode } from 'react';
|
|
25
|
-
export interface AfterAuthProps {
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
}
|
|
28
|
-
export declare const AfterAuth: FC<AfterAuthProps>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var afterAuth_exports = {};
|
|
20
|
-
__export(afterAuth_exports, {
|
|
21
|
-
AfterAuth: () => AfterAuth
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(afterAuth_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var import_useAuthConfig = require("../hooks/useAuthConfig");
|
|
27
|
-
var import_state = require("../state");
|
|
28
|
-
var import_hooks = require("../hooks");
|
|
29
|
-
const logger = console;
|
|
30
|
-
const AfterAuth = ({ children }) => {
|
|
31
|
-
const authConfig = (0, import_useAuthConfig.useAuthConfig)();
|
|
32
|
-
const authState = (0, import_state.useAuthState)();
|
|
33
|
-
const { token, refreshToken, authenticated, idToken } = (0, import_hooks.useKeycloak)();
|
|
34
|
-
(0, import_react.useEffect)(() => {
|
|
35
|
-
if (!authenticated)
|
|
36
|
-
return;
|
|
37
|
-
if (authConfig.persist && token) {
|
|
38
|
-
authState.setToken(token);
|
|
39
|
-
if (idToken)
|
|
40
|
-
authState.setIdToken(idToken);
|
|
41
|
-
if (authConfig.ensureFreshness && refreshToken)
|
|
42
|
-
authState.setRefreshToken(refreshToken);
|
|
43
|
-
}
|
|
44
|
-
}, [token, refreshToken, idToken]);
|
|
45
|
-
(0, import_react.useEffect)(() => {
|
|
46
|
-
if (authConfig.debug && authState.token)
|
|
47
|
-
logger.debug("token", authState.token);
|
|
48
|
-
}, [authState.token]);
|
|
49
|
-
(0, import_react.useEffect)(() => {
|
|
50
|
-
if (authConfig.debug && authState.idToken)
|
|
51
|
-
logger.debug("idToken", authState.idToken);
|
|
52
|
-
}, [authState.idToken]);
|
|
53
|
-
(0, import_react.useEffect)(() => {
|
|
54
|
-
if (authConfig.debug && authState.refreshToken)
|
|
55
|
-
logger.debug("refreshToken", authState.refreshToken);
|
|
56
|
-
}, [authState.refreshToken]);
|
|
57
|
-
(0, import_react.useEffect)(() => {
|
|
58
|
-
if (authConfig.debug)
|
|
59
|
-
logger.debug("authenticated", authenticated);
|
|
60
|
-
}, [authenticated]);
|
|
61
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
62
|
-
};
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
AfterAuth
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=afterAuth.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/provider/afterAuth.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /auth/provider/afterAuth.tsx\n * Project: app\n * File Created: 22-11-2022 17:49:58\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:00:39\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\nimport type { FC, ReactNode } from 'react';\nimport { useAuthConfig } from '../hooks/useAuthConfig';\nimport { useAuthState } from '../state';\nimport { useKeycloak } from '../hooks';\n\nexport interface AfterAuthProps {\n children: ReactNode;\n}\n\nconst logger = console;\n\nexport const AfterAuth: FC<AfterAuthProps> = ({ children }: AfterAuthProps) => {\n const authConfig = useAuthConfig();\n const authState = useAuthState();\n const { token, refreshToken, authenticated, idToken } = useKeycloak();\n\n useEffect(() => {\n if (!authenticated) return;\n if (authConfig.persist && token) {\n authState.setToken(token);\n if (idToken) authState.setIdToken(idToken);\n if (authConfig.ensureFreshness && refreshToken) authState.setRefreshToken(refreshToken);\n }\n }, [token, refreshToken, idToken]);\n\n useEffect(() => {\n if (authConfig.debug && authState.token) logger.debug('token', authState.token);\n }, [authState.token]);\n\n useEffect(() => {\n if (authConfig.debug && authState.idToken) logger.debug('idToken', authState.idToken);\n }, [authState.idToken]);\n\n useEffect(() => {\n if (authConfig.debug && authState.refreshToken) logger.debug('refreshToken', authState.refreshToken);\n }, [authState.refreshToken]);\n\n useEffect(() => {\n if (authConfig.debug) logger.debug('authenticated', authenticated);\n }, [authenticated]);\n\n return <>{children}</>;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkES;AA1CT,mBAAiC;AAEjC,2BAA8B;AAC9B,mBAA6B;AAC7B,mBAA4B;AAM5B,MAAM,SAAS;AAER,MAAM,YAAgC,CAAC,EAAE,SAAS,MAAsB;AAC7E,QAAM,iBAAa,oCAAc;AACjC,QAAM,gBAAY,2BAAa;AAC/B,QAAM,EAAE,OAAO,cAAc,eAAe,QAAQ,QAAI,0BAAY;AAEpE,8BAAU,MAAM;AACd,QAAI,CAAC;AAAe;AACpB,QAAI,WAAW,WAAW,OAAO;AAC/B,gBAAU,SAAS,KAAK;AACxB,UAAI;AAAS,kBAAU,WAAW,OAAO;AACzC,UAAI,WAAW,mBAAmB;AAAc,kBAAU,gBAAgB,YAAY;AAAA,IACxF;AAAA,EACF,GAAG,CAAC,OAAO,cAAc,OAAO,CAAC;AAEjC,8BAAU,MAAM;AACd,QAAI,WAAW,SAAS,UAAU;AAAO,aAAO,MAAM,SAAS,UAAU,KAAK;AAAA,EAChF,GAAG,CAAC,UAAU,KAAK,CAAC;AAEpB,8BAAU,MAAM;AACd,QAAI,WAAW,SAAS,UAAU;AAAS,aAAO,MAAM,WAAW,UAAU,OAAO;AAAA,EACtF,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,8BAAU,MAAM;AACd,QAAI,WAAW,SAAS,UAAU;AAAc,aAAO,MAAM,gBAAgB,UAAU,YAAY;AAAA,EACrG,GAAG,CAAC,UAAU,YAAY,CAAC;AAE3B,8BAAU,MAAM;AACd,QAAI,WAAW;AAAO,aAAO,MAAM,iBAAiB,aAAa;AAAA,EACnE,GAAG,CAAC,aAAa,CAAC;AAElB,SAAO,2EAAG,UAAS;AACrB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /auth/provider/index.tsx
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 06:33:07
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 22-11-2022 18:00:13
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
import type { AuthClientEvent, AuthClientError, AuthClientTokens } from '@bitspur/react-keycloak-core';
|
|
25
|
-
import type { AuthConfig } from '../authConfig';
|
|
26
|
-
import type { FC, ComponentType, ReactNode } from 'react';
|
|
27
|
-
import type { KeycloakConfig, KeycloakInitOptions } from '@bitspur/keycloak-js';
|
|
28
|
-
export interface AuthProviderProps extends Partial<Omit<AuthConfig, 'persist'>>, Partial<Omit<KeycloakConfig, 'url'>>, KeycloakInitOptions {
|
|
29
|
-
children: ReactNode;
|
|
30
|
-
cookies?: unknown;
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
baseUrl?: string;
|
|
33
|
-
loadingComponent?: ComponentType;
|
|
34
|
-
onEvent?: (eventType: AuthClientEvent, error?: AuthClientError) => void;
|
|
35
|
-
onTokens?: (tokens: AuthClientTokens) => void;
|
|
36
|
-
}
|
|
37
|
-
export declare const AuthProvider: FC<AuthProviderProps>;
|
|
38
|
-
export * from './keycloakProvider';
|