@multiplatform.one/keycloak 0.1.9 → 0.2.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/dist/esm/Authenticated.mjs +25 -0
- package/dist/esm/Authenticated.mjs.map +7 -0
- package/dist/esm/authConfig.mjs +10 -0
- package/dist/esm/authConfig.mjs.map +7 -0
- package/dist/esm/hooks/index.mjs +4 -0
- package/dist/esm/hooks/index.mjs.map +7 -0
- package/dist/esm/hooks/useAuthConfig.mjs +9 -0
- package/dist/esm/hooks/useAuthConfig.mjs.map +7 -0
- package/dist/esm/hooks/useCurrentRouteName/index.mjs +17 -0
- package/dist/esm/hooks/useCurrentRouteName/index.mjs.map +7 -0
- package/dist/esm/hooks/useCurrentRouteName/index.native.mjs +12 -0
- package/dist/esm/hooks/useCurrentRouteName/index.native.mjs.map +7 -0
- package/dist/esm/hooks/useKeycloak/index.mjs +2 -0
- package/dist/esm/hooks/useKeycloak/index.mjs.map +7 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs +81 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs.map +7 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs +108 -0
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs.map +7 -0
- package/dist/esm/hooks/useLogin.mjs +35 -0
- package/dist/esm/hooks/useLogin.mjs.map +7 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/esm/provider/afterAuth.mjs +29 -0
- package/dist/esm/provider/afterAuth.mjs.map +7 -0
- package/dist/esm/provider/index.mjs +73 -0
- package/dist/esm/provider/index.mjs.map +7 -0
- package/dist/esm/provider/keycloakProvider.mjs +275 -0
- package/dist/esm/provider/keycloakProvider.mjs.map +7 -0
- package/dist/esm/provider/keycloakProvider.native.mjs +69 -0
- package/dist/esm/provider/keycloakProvider.native.mjs.map +7 -0
- package/dist/esm/state/index.mjs +14 -0
- package/dist/esm/state/index.mjs.map +7 -0
- package/dist/esm/types.mjs +5 -0
- package/dist/esm/types.mjs.map +7 -0
- package/dist/jsx/Authenticated.mjs +20 -0
- package/dist/jsx/Authenticated.mjs.map +7 -0
- package/dist/jsx/authConfig.mjs +10 -0
- package/dist/jsx/authConfig.mjs.map +7 -0
- package/dist/jsx/hooks/index.mjs +4 -0
- package/dist/jsx/hooks/index.mjs.map +7 -0
- package/dist/jsx/hooks/useAuthConfig.mjs +9 -0
- package/dist/jsx/hooks/useAuthConfig.mjs.map +7 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.mjs +17 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.mjs.map +7 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs +12 -0
- package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs.map +7 -0
- package/dist/jsx/hooks/useKeycloak/index.mjs +2 -0
- package/dist/jsx/hooks/useKeycloak/index.mjs.map +7 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs +25 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs.map +7 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs +58 -0
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs.map +7 -0
- package/dist/jsx/hooks/useLogin.mjs +33 -0
- package/dist/jsx/hooks/useLogin.mjs.map +7 -0
- package/dist/jsx/index.mjs +5 -0
- package/dist/jsx/index.mjs.map +7 -0
- package/dist/jsx/provider/afterAuth.mjs +28 -0
- package/dist/jsx/provider/afterAuth.mjs.map +7 -0
- package/dist/jsx/provider/index.mjs +20 -0
- package/dist/jsx/provider/index.mjs.map +7 -0
- package/dist/jsx/provider/keycloakProvider.mjs +158 -0
- package/dist/jsx/provider/keycloakProvider.mjs.map +7 -0
- package/dist/jsx/provider/keycloakProvider.native.mjs +14 -0
- package/dist/jsx/provider/keycloakProvider.native.mjs.map +7 -0
- package/dist/jsx/state/index.mjs +17 -0
- package/dist/jsx/state/index.mjs.map +7 -0
- package/dist/jsx/types.mjs +5 -0
- package/dist/jsx/types.mjs.map +7 -0
- package/{lib → dist/lib}/Authenticated.d.ts +1 -1
- package/dist/lib/Authenticated.js +60 -0
- package/dist/lib/Authenticated.js.map +7 -0
- package/dist/lib/authConfig.js +35 -0
- package/dist/lib/authConfig.js.map +7 -0
- package/{lib → dist/lib}/hooks/index.d.ts +3 -3
- package/dist/lib/hooks/index.js +21 -0
- package/dist/lib/hooks/index.js.map +7 -0
- package/dist/lib/hooks/useAuthConfig.js +33 -0
- package/dist/lib/hooks/useAuthConfig.js.map +7 -0
- package/{lib/hooks/useCurrentRouteName.d.ts → dist/lib/hooks/useCurrentRouteName/index.d.ts} +5 -5
- package/dist/lib/hooks/useCurrentRouteName/index.js +41 -0
- package/dist/lib/hooks/useCurrentRouteName/index.js.map +7 -0
- package/{esm/types.js → dist/lib/hooks/useCurrentRouteName/index.native.d.ts} +5 -7
- package/dist/lib/hooks/useCurrentRouteName/index.native.js +36 -0
- package/dist/lib/hooks/useCurrentRouteName/index.native.js.map +7 -0
- package/{lib → dist/lib}/hooks/useKeycloak/index.d.ts +2 -2
- package/dist/lib/hooks/useKeycloak/index.js +19 -0
- package/dist/lib/hooks/useKeycloak/index.js.map +7 -0
- package/{lib → dist/lib}/hooks/useKeycloak/useKeycloak.d.ts +2 -2
- package/dist/lib/hooks/useKeycloak/useKeycloak.js +63 -0
- package/dist/lib/hooks/useKeycloak/useKeycloak.js.map +7 -0
- package/{lib → dist/lib}/hooks/useKeycloak/useKeycloak.native.d.ts +4 -4
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js +93 -0
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js.map +7 -0
- package/{lib → dist/lib}/hooks/useLogin.d.ts +1 -1
- package/dist/lib/hooks/useLogin.js +57 -0
- package/dist/lib/hooks/useLogin.js.map +7 -0
- package/{lib → dist/lib}/index.d.ts +4 -4
- package/dist/lib/index.js +22 -0
- package/dist/lib/index.js.map +7 -0
- package/{lib → dist/lib}/provider/afterAuth.d.ts +1 -1
- package/dist/lib/provider/afterAuth.js +53 -0
- package/dist/lib/provider/afterAuth.js.map +7 -0
- package/{lib → dist/lib}/provider/index.d.ts +4 -4
- package/dist/lib/provider/index.js +61 -0
- package/dist/lib/provider/index.js.map +7 -0
- package/{lib → dist/lib}/provider/keycloakProvider.d.ts +2 -2
- package/dist/lib/provider/keycloakProvider.js +212 -0
- package/dist/lib/provider/keycloakProvider.js.map +7 -0
- package/{lib → dist/lib}/provider/keycloakProvider.native.d.ts +2 -2
- package/dist/lib/provider/keycloakProvider.native.js +55 -0
- package/dist/lib/provider/keycloakProvider.native.js.map +7 -0
- package/{esm/state/index.js → dist/lib/state/index.d.ts} +8 -13
- package/dist/lib/state/index.js +41 -0
- package/dist/lib/state/index.js.map +7 -0
- package/dist/lib/tsconfig.build.tsbuildinfo +1 -0
- package/dist/lib/types.js +27 -0
- package/dist/lib/types.js.map +7 -0
- package/package.json +43 -62
- package/src/@types/coreJsPure.d.ts +2 -2
- package/src/@types/expoKeycloakAuth.d.ts +1 -1
- package/src/Authenticated.tsx +5 -8
- package/src/authConfig.ts +1 -1
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useAuthConfig.ts +2 -2
- package/{esm/hooks/useCurrentRouteName.js → src/hooks/useCurrentRouteName/index.native.ts} +8 -13
- package/src/hooks/{useCurrentRouteName.ts → useCurrentRouteName/index.ts} +8 -8
- package/src/hooks/useKeycloak/index.ts +2 -6
- package/src/hooks/useKeycloak/useKeycloak.native.ts +18 -32
- package/src/hooks/useKeycloak/useKeycloak.ts +7 -7
- package/src/hooks/useLogin.ts +7 -7
- package/src/index.ts +4 -4
- package/src/provider/afterAuth.tsx +10 -11
- package/src/provider/index.tsx +9 -12
- package/src/provider/keycloakProvider.native.tsx +8 -10
- package/src/provider/keycloakProvider.tsx +44 -61
- package/src/state/index.ts +13 -10
- package/esm/Authenticated.js +0 -42
- package/esm/Authenticated.js.map +0 -1
- package/esm/authConfig.js +0 -30
- package/esm/authConfig.js.map +0 -1
- package/esm/hooks/index.js +0 -28
- package/esm/hooks/index.js.map +0 -1
- package/esm/hooks/useAuthConfig.js +0 -30
- package/esm/hooks/useAuthConfig.js.map +0 -1
- package/esm/hooks/useCurrentRouteName.js.map +0 -1
- package/esm/hooks/useKeycloak/index.js +0 -27
- package/esm/hooks/useKeycloak/index.js.map +0 -1
- package/esm/hooks/useKeycloak/useKeycloak.js +0 -55
- package/esm/hooks/useKeycloak/useKeycloak.js.map +0 -1
- package/esm/hooks/useKeycloak/useKeycloak.native.js +0 -91
- package/esm/hooks/useKeycloak/useKeycloak.native.js.map +0 -1
- package/esm/hooks/useLogin.js +0 -50
- package/esm/hooks/useLogin.js.map +0 -1
- package/esm/index.js +0 -29
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -1
- package/esm/provider/afterAuth.js +0 -58
- package/esm/provider/afterAuth.js.map +0 -1
- package/esm/provider/index.js +0 -43
- package/esm/provider/index.js.map +0 -1
- package/esm/provider/keycloakProvider.js +0 -175
- package/esm/provider/keycloakProvider.js.map +0 -1
- package/esm/provider/keycloakProvider.native.js +0 -41
- package/esm/provider/keycloakProvider.native.js.map +0 -1
- package/esm/state/index.js.map +0 -1
- package/esm/types.js.map +0 -1
- package/lib/Authenticated.js +0 -64
- package/lib/Authenticated.js.map +0 -1
- package/lib/authConfig.js +0 -51
- package/lib/authConfig.js.map +0 -1
- package/lib/hooks/index.js +0 -50
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/useAuthConfig.js +0 -48
- package/lib/hooks/useAuthConfig.js.map +0 -1
- package/lib/hooks/useCurrentRouteName.js +0 -54
- package/lib/hooks/useCurrentRouteName.js.map +0 -1
- package/lib/hooks/useKeycloak/index.js +0 -30
- package/lib/hooks/useKeycloak/index.js.map +0 -1
- package/lib/hooks/useKeycloak/useKeycloak.js +0 -71
- package/lib/hooks/useKeycloak/useKeycloak.js.map +0 -1
- package/lib/hooks/useKeycloak/useKeycloak.native.js +0 -112
- package/lib/hooks/useKeycloak/useKeycloak.native.js.map +0 -1
- package/lib/hooks/useLogin.js +0 -65
- package/lib/hooks/useLogin.js.map +0 -1
- package/lib/index.js +0 -60
- package/lib/index.js.map +0 -1
- package/lib/package.json +0 -1
- package/lib/provider/afterAuth.js +0 -78
- package/lib/provider/afterAuth.js.map +0 -1
- package/lib/provider/index.js +0 -77
- package/lib/provider/index.js.map +0 -1
- package/lib/provider/keycloakProvider.js +0 -193
- package/lib/provider/keycloakProvider.js.map +0 -1
- package/lib/provider/keycloakProvider.native.js +0 -61
- package/lib/provider/keycloakProvider.native.js.map +0 -1
- package/lib/state/index.d.ts +0 -34
- package/lib/state/index.js +0 -55
- package/lib/state/index.js.map +0 -1
- package/lib/tsconfig.build.tsbuildinfo +0 -1
- package/lib/types.js +0 -46
- package/lib/types.js.map +0 -1
- /package/{lib → dist/lib}/authConfig.d.ts +0 -0
- /package/{lib → dist/lib}/hooks/useAuthConfig.d.ts +0 -0
- /package/{lib → dist/lib}/types.d.ts +0 -0
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /auth/provider/keycloakProvider.tsx
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 03:12:43
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 22-11-2022 18:07: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
|
-
|
|
25
|
-
import Keycloak from "keycloak-js";
|
|
26
|
-
import { MultiPlatform } from "multiplatform.one";
|
|
27
|
-
import { ReactKeycloakProvider } from "@react-keycloak/web";
|
|
28
|
-
import { SSRKeycloakProvider, SSRCookies } from "@react-keycloak/ssr";
|
|
29
|
-
import { useRouter } from "next/router";
|
|
30
|
-
import React, { useMemo, useEffect, useState } from "react";
|
|
31
|
-
import { useAuthConfig } from "../hooks/useAuthConfig";
|
|
32
|
-
import { useAuthState } from "../state";
|
|
33
|
-
import { AfterAuth } from "./afterAuth";
|
|
34
|
-
const logger = console;
|
|
35
|
-
export const KeycloakProvider = _ref => {
|
|
36
|
-
var _query$token, _query$refreshToken;
|
|
37
|
-
let {
|
|
38
|
-
children,
|
|
39
|
-
cookies,
|
|
40
|
-
debug,
|
|
41
|
-
keycloakConfig,
|
|
42
|
-
keycloakInitOptions,
|
|
43
|
-
loadingComponent
|
|
44
|
-
} = _ref;
|
|
45
|
-
const [auth] = useAuthState();
|
|
46
|
-
const LoadingComponent = loadingComponent || (() => /*#__PURE__*/React.createElement(React.Fragment, null, debug ? "authenticating" : null));
|
|
47
|
-
const {
|
|
48
|
-
query
|
|
49
|
-
} = MultiPlatform.isNext ? useRouter() : {
|
|
50
|
-
query: {}
|
|
51
|
-
};
|
|
52
|
-
const authConfig = useAuthConfig();
|
|
53
|
-
const [token, setToken] = useState("token" in query && (((_query$token = query.token) === null || _query$token === void 0 ? void 0 : _query$token.toString()) || true) || auth.token || false);
|
|
54
|
-
const [refreshToken, setRefreshToken] = useState("refreshToken" in query && (((_query$refreshToken = query.refreshToken) === null || _query$refreshToken === void 0 ? void 0 : _query$refreshToken.toString()) || true) || auth.refreshToken || false);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
var _window2, _window2$ReactNativeW, _window3, _window3$parent;
|
|
57
|
-
if (token !== true && refreshToken !== true) return;
|
|
58
|
-
if (debug) logger.debug("post message", {
|
|
59
|
-
type: "LOADED"
|
|
60
|
-
});
|
|
61
|
-
(authConfig.messageHandlerKeys || []).forEach(key => {
|
|
62
|
-
var _window, _window$webkit, _window$webkit$messag, _window$webkit$messag2;
|
|
63
|
-
(_window = window) === null || _window === void 0 ? void 0 : (_window$webkit = _window.webkit) === null || _window$webkit === void 0 ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) === null || _window$webkit$messag === void 0 ? void 0 : (_window$webkit$messag2 = _window$webkit$messag[key]) === null || _window$webkit$messag2 === void 0 ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
|
|
64
|
-
type: "LOADED"
|
|
65
|
-
}));
|
|
66
|
-
});
|
|
67
|
-
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$ReactNativeW = _window2.ReactNativeWebView) === null || _window2$ReactNativeW === void 0 ? void 0 : _window2$ReactNativeW.postMessage(JSON.stringify({
|
|
68
|
-
type: "LOADED"
|
|
69
|
-
}));
|
|
70
|
-
(_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$parent = _window3.parent) === null || _window3$parent === void 0 ? void 0 : _window3$parent.postMessage(JSON.stringify({
|
|
71
|
-
type: "LOADED"
|
|
72
|
-
}));
|
|
73
|
-
}, []);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (token !== true) return;
|
|
76
|
-
const messageCallback = e => {
|
|
77
|
-
let data = e === null || e === void 0 ? void 0 : e.data;
|
|
78
|
-
if (typeof data === "string") {
|
|
79
|
-
try {
|
|
80
|
-
data = JSON.parse(data);
|
|
81
|
-
} catch (err) {}
|
|
82
|
-
}
|
|
83
|
-
if (debug) logger.debug("received message", data);
|
|
84
|
-
const message = data;
|
|
85
|
-
if (!message.type) return;
|
|
86
|
-
if (message.type.toUpperCase() === "TOKEN" && message.payload) {
|
|
87
|
-
if (debug) logger.debug("setting token", message.payload);
|
|
88
|
-
setToken(message.payload);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
if (debug) logger.debug("listening for message", {
|
|
92
|
-
type: "TOKEN",
|
|
93
|
-
payload: "<some_token>"
|
|
94
|
-
});
|
|
95
|
-
window.addEventListener("message", messageCallback);
|
|
96
|
-
return () => {
|
|
97
|
-
window.removeEventListener("message", messageCallback);
|
|
98
|
-
};
|
|
99
|
-
}, []);
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
if (refreshToken !== true) return;
|
|
102
|
-
const messageCallback = e => {
|
|
103
|
-
let data = e === null || e === void 0 ? void 0 : e.data;
|
|
104
|
-
if (typeof data === "string") {
|
|
105
|
-
try {
|
|
106
|
-
data = JSON.parse(data);
|
|
107
|
-
} catch (err) {}
|
|
108
|
-
}
|
|
109
|
-
if (debug) logger.debug("received message", data);
|
|
110
|
-
const message = data;
|
|
111
|
-
if (!message.type) return;
|
|
112
|
-
if (message.type.toUpperCase() === "REFRESH_TOKEN" && message.payload) {
|
|
113
|
-
if (debug) logger.debug("setting refresh token", message.payload);
|
|
114
|
-
setRefreshToken(message.payload);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
if (debug) logger.debug("listening for message", {
|
|
118
|
-
type: "REFRESH_TOKEN",
|
|
119
|
-
payload: "<some_refresh_token>"
|
|
120
|
-
});
|
|
121
|
-
window.addEventListener("message", messageCallback);
|
|
122
|
-
return () => {
|
|
123
|
-
window.removeEventListener("message", messageCallback);
|
|
124
|
-
};
|
|
125
|
-
}, []);
|
|
126
|
-
const keycloak = useMemo(() => typeof window !== "undefined" && new Keycloak({
|
|
127
|
-
url: keycloakConfig.baseUrl,
|
|
128
|
-
realm: keycloakConfig.realm,
|
|
129
|
-
clientId: keycloakConfig.clientId
|
|
130
|
-
}), []);
|
|
131
|
-
const initOptions = useMemo(() => {
|
|
132
|
-
const initOptions = {
|
|
133
|
-
...defaultKeycloakInitOptions,
|
|
134
|
-
...keycloakInitOptions
|
|
135
|
-
};
|
|
136
|
-
if (token && typeof token === "string") {
|
|
137
|
-
initOptions.token = token;
|
|
138
|
-
if (refreshToken && typeof refreshToken === "string") initOptions.refreshToken = refreshToken;
|
|
139
|
-
initOptions.checkLoginIframe = false;
|
|
140
|
-
initOptions.onLoad = undefined;
|
|
141
|
-
}
|
|
142
|
-
return initOptions;
|
|
143
|
-
}, [keycloakInitOptions, token, refreshToken]);
|
|
144
|
-
if (token === true || refreshToken === true) return /*#__PURE__*/React.createElement(LoadingComponent, null);
|
|
145
|
-
if (cookies && authConfig.ssr) {
|
|
146
|
-
return (
|
|
147
|
-
/*#__PURE__*/
|
|
148
|
-
// @ts-ignore
|
|
149
|
-
React.createElement(SSRKeycloakProvider, {
|
|
150
|
-
initOptions: initOptions,
|
|
151
|
-
keycloakConfig: {
|
|
152
|
-
url: keycloakConfig.baseUrl,
|
|
153
|
-
realm: keycloakConfig.realm,
|
|
154
|
-
clientId: keycloakConfig.clientId
|
|
155
|
-
},
|
|
156
|
-
persistor: SSRCookies(cookies),
|
|
157
|
-
LoadingComponent: /*#__PURE__*/React.createElement(LoadingComponent, null)
|
|
158
|
-
}, /*#__PURE__*/React.createElement(AfterAuth, null, children))
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
if (!keycloak) return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
162
|
-
return /*#__PURE__*/React.createElement(ReactKeycloakProvider, {
|
|
163
|
-
initOptions: initOptions,
|
|
164
|
-
authClient: keycloak,
|
|
165
|
-
LoadingComponent: /*#__PURE__*/React.createElement(LoadingComponent, null)
|
|
166
|
-
}, /*#__PURE__*/React.createElement(AfterAuth, null, children));
|
|
167
|
-
};
|
|
168
|
-
export const defaultKeycloakInitOptions = {
|
|
169
|
-
checkLoginIframe: true,
|
|
170
|
-
checkLoginIframeInterval: 5,
|
|
171
|
-
enableLogging: false,
|
|
172
|
-
onLoad: "check-sso",
|
|
173
|
-
pkceMethod: "S256"
|
|
174
|
-
};
|
|
175
|
-
//# sourceMappingURL=keycloakProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keycloakProvider.js","names":["Keycloak","MultiPlatform","ReactKeycloakProvider","SSRKeycloakProvider","SSRCookies","useRouter","React","useMemo","useEffect","useState","useAuthConfig","useAuthState","AfterAuth","logger","console","KeycloakProvider","children","cookies","debug","keycloakConfig","keycloakInitOptions","loadingComponent","auth","LoadingComponent","query","isNext","authConfig","token","setToken","toString","refreshToken","setRefreshToken","type","messageHandlerKeys","forEach","key","window","webkit","messageHandlers","postMessage","JSON","stringify","ReactNativeWebView","parent","messageCallback","e","data","parse","err","message","toUpperCase","payload","addEventListener","removeEventListener","keycloak","url","baseUrl","realm","clientId","initOptions","defaultKeycloakInitOptions","checkLoginIframe","onLoad","undefined","ssr","checkLoginIframeInterval","enableLogging","pkceMethod"],"sources":["../../src/provider/keycloakProvider.tsx"],"sourcesContent":["/**\n * File: /auth/provider/keycloakProvider.tsx\n * Project: app\n * File Created: 08-11-2022 03:12:43\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:07:46\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keycloak, { KeycloakInitOptions } from \"keycloak-js\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { ReactKeycloakProvider } from \"@react-keycloak/web\";\nimport { SSRKeycloakProvider, SSRCookies } from \"@react-keycloak/ssr\";\nimport { useRouter } from \"next/router\";\nimport React, {\n FC,\n ReactNode,\n useMemo,\n useEffect,\n useState,\n ComponentType,\n} from \"react\";\nimport { useAuthConfig } from \"../hooks/useAuthConfig\";\nimport { useAuthState } from \"../state\";\nimport { AfterAuth } from \"./afterAuth\";\n\nexport interface KeycloakProviderProps {\n children: ReactNode;\n cookies?: unknown;\n debug?: boolean;\n disabled?: boolean;\n keycloakConfig: KeycloakConfig;\n keycloakInitOptions?: KeycloakInitOptions;\n loadingComponent?: ComponentType;\n}\n\nconst logger = console;\n\nexport const KeycloakProvider: FC<KeycloakProviderProps> = ({\n children,\n cookies,\n debug,\n keycloakConfig,\n keycloakInitOptions,\n loadingComponent,\n}: KeycloakProviderProps) => {\n const [auth] = useAuthState();\n const LoadingComponent =\n loadingComponent || (() => <>{debug ? \"authenticating\" : null}</>);\n const { query } = MultiPlatform.isNext ? useRouter() : { query: {} };\n const authConfig = useAuthConfig();\n const [token, setToken] = useState<string | boolean>(\n (\"token\" in query && (query.token?.toString() || true)) ||\n auth.token ||\n false\n );\n const [refreshToken, setRefreshToken] = useState<string | boolean>(\n (\"refreshToken\" in query && (query.refreshToken?.toString() || true)) ||\n auth.refreshToken ||\n false\n );\n\n useEffect(() => {\n if (token !== true && refreshToken !== true) return;\n if (debug) logger.debug(\"post message\", { type: \"LOADED\" });\n (authConfig.messageHandlerKeys || []).forEach((key: string) => {\n window?.webkit?.messageHandlers?.[key]?.postMessage(\n JSON.stringify({ type: \"LOADED\" })\n );\n });\n window?.ReactNativeWebView?.postMessage(JSON.stringify({ type: \"LOADED\" }));\n window?.parent?.postMessage(JSON.stringify({ type: \"LOADED\" }));\n }, []);\n\n useEffect(() => {\n if (token !== true) return;\n const messageCallback = (e: MessageEvent<any>) => {\n let data = e?.data;\n if (typeof data === \"string\") {\n try {\n data = JSON.parse(data);\n } catch (err) {}\n }\n if (debug) logger.debug(\"received message\", data);\n const message: MessageSchema = data;\n if (!message.type) return;\n if (message.type.toUpperCase() === \"TOKEN\" && message.payload) {\n if (debug) logger.debug(\"setting token\", message.payload);\n setToken(message.payload);\n }\n };\n if (debug)\n logger.debug(\"listening for message\", {\n type: \"TOKEN\",\n payload: \"<some_token>\",\n });\n window.addEventListener(\"message\", messageCallback);\n return () => {\n window.removeEventListener(\"message\", messageCallback);\n };\n }, []);\n\n useEffect(() => {\n if (refreshToken !== true) return;\n const messageCallback = (e: MessageEvent<any>) => {\n let data = e?.data;\n if (typeof data === \"string\") {\n try {\n data = JSON.parse(data);\n } catch (err) {}\n }\n if (debug) logger.debug(\"received message\", data);\n const message: MessageSchema = data;\n if (!message.type) return;\n if (message.type.toUpperCase() === \"REFRESH_TOKEN\" && message.payload) {\n if (debug) logger.debug(\"setting refresh token\", message.payload);\n setRefreshToken(message.payload);\n }\n };\n if (debug)\n logger.debug(\"listening for message\", {\n type: \"REFRESH_TOKEN\",\n payload: \"<some_refresh_token>\",\n });\n window.addEventListener(\"message\", messageCallback);\n return () => {\n window.removeEventListener(\"message\", messageCallback);\n };\n }, []);\n\n const keycloak = useMemo(\n () =>\n typeof window !== \"undefined\" &&\n new Keycloak({\n url: keycloakConfig.baseUrl,\n realm: keycloakConfig.realm,\n clientId: keycloakConfig.clientId,\n }),\n []\n );\n\n const initOptions = useMemo(() => {\n const initOptions = {\n ...defaultKeycloakInitOptions,\n ...keycloakInitOptions,\n };\n if (token && typeof token === \"string\") {\n initOptions.token = token;\n if (refreshToken && typeof refreshToken === \"string\")\n initOptions.refreshToken = refreshToken;\n initOptions.checkLoginIframe = false;\n initOptions.onLoad = undefined;\n }\n return initOptions;\n }, [keycloakInitOptions, token, refreshToken]);\n\n if (token === true || refreshToken === true) return <LoadingComponent />;\n if (cookies && authConfig.ssr) {\n return (\n // @ts-ignore\n <SSRKeycloakProvider\n initOptions={initOptions}\n keycloakConfig={{\n url: keycloakConfig.baseUrl,\n realm: keycloakConfig.realm,\n clientId: keycloakConfig.clientId,\n }}\n persistor={SSRCookies(cookies)}\n LoadingComponent={<LoadingComponent />}\n >\n <AfterAuth>{children}</AfterAuth>\n </SSRKeycloakProvider>\n );\n }\n if (!keycloak) return <>{children}</>;\n return (\n <ReactKeycloakProvider\n initOptions={initOptions}\n authClient={keycloak}\n LoadingComponent={<LoadingComponent />}\n >\n <AfterAuth>{children}</AfterAuth>\n </ReactKeycloakProvider>\n );\n};\n\nexport interface KeycloakConfig {\n clientId: string;\n realm: string;\n scheme?: string;\n baseUrl: string;\n}\n\nexport const defaultKeycloakInitOptions: KeycloakInitOptions = {\n checkLoginIframe: true,\n checkLoginIframeInterval: 5,\n enableLogging: false,\n onLoad: \"check-sso\",\n pkceMethod: \"S256\",\n};\n\nexport interface MessageSchema {\n type: string;\n payload?: string;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,QAAQ,MAA+B,aAAa;AAC3D,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,qBAAqB,QAAQ,qBAAqB;AAC3D,SAASC,mBAAmB,EAAEC,UAAU,QAAQ,qBAAqB;AACrE,SAASC,SAAS,QAAQ,aAAa;AACvC,OAAOC,KAAK,IAGVC,OAAO,EACPC,SAAS,EACTC,QAAQ,QAEH,OAAO;AACd,SAASC,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,SAAS;AAYlB,MAAMC,MAAM,GAAGC,OAAO;AAEtB,OAAO,MAAMC,gBAA2C,GAAG,QAO9B;EAAA;EAAA,IAP+B;IAC1DC,QAAQ;IACRC,OAAO;IACPC,KAAK;IACLC,cAAc;IACdC,mBAAmB;IACnBC;EACqB,CAAC;EACtB,MAAM,CAACC,IAAI,CAAC,GAAGX,YAAY,EAAE;EAC7B,MAAMY,gBAAgB,GACpBF,gBAAgB,KAAK,mBAAM,0CAAGH,KAAK,GAAG,gBAAgB,GAAG,IAAI,CAAI,CAAC;EACpE,MAAM;IAAEM;EAAM,CAAC,GAAGvB,aAAa,CAACwB,MAAM,GAAGpB,SAAS,EAAE,GAAG;IAAEmB,KAAK,EAAE,CAAC;EAAE,CAAC;EAC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E,KAAK;EACpBJ,MAAM,EAAE,WAAW;EACnBK,UAAU,EAAE;AACd,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /auth/provider/keycloakProvider.native.tsx
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 03:12:37
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 22-11-2022 17: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
|
-
|
|
25
|
-
import React from "react";
|
|
26
|
-
import { AfterAuth } from "./afterAuth";
|
|
27
|
-
import { KeycloakProvider as ExpoKeycloakProvider } from "expo-keycloak-auth";
|
|
28
|
-
export const KeycloakProvider = _ref => {
|
|
29
|
-
let {
|
|
30
|
-
children,
|
|
31
|
-
keycloakConfig
|
|
32
|
-
} = _ref;
|
|
33
|
-
const clonedKeycloakConfig = {
|
|
34
|
-
...keycloakConfig,
|
|
35
|
-
url: keycloakConfig.baseUrl
|
|
36
|
-
};
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
delete keycloakConfig.baseUrl;
|
|
39
|
-
return /*#__PURE__*/React.createElement(ExpoKeycloakProvider, clonedKeycloakConfig, /*#__PURE__*/React.createElement(AfterAuth, null, children));
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=keycloakProvider.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keycloakProvider.native.js","names":["React","AfterAuth","KeycloakProvider","ExpoKeycloakProvider","children","keycloakConfig","clonedKeycloakConfig","url","baseUrl"],"sources":["../../src/provider/keycloakProvider.native.tsx"],"sourcesContent":["/**\n * File: /auth/provider/keycloakProvider.native.tsx\n * Project: app\n * File Created: 08-11-2022 03:12:37\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 17:52:31\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { FC } from \"react\";\nimport type { KeycloakProviderProps } from \"./keycloakProvider\";\nimport { AfterAuth } from \"./afterAuth\";\nimport { KeycloakConfig } from \"keycloak-js\";\nimport { KeycloakProvider as ExpoKeycloakProvider } from \"expo-keycloak-auth\";\n\nexport const KeycloakProvider: FC<KeycloakProviderProps> = ({\n children,\n keycloakConfig,\n}: KeycloakProviderProps) => {\n const clonedKeycloakConfig = {\n ...(keycloakConfig as Omit<KeycloakConfig, \"baseUrl\">),\n url: keycloakConfig.baseUrl,\n };\n // @ts-ignore\n delete keycloakConfig.baseUrl;\n return (\n <ExpoKeycloakProvider {...clonedKeycloakConfig}>\n <AfterAuth>{children}</AfterAuth>\n </ExpoKeycloakProvider>\n );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAc,OAAO;AAEjC,SAASC,SAAS;AAElB,SAASC,gBAAgB,IAAIC,oBAAoB,QAAQ,oBAAoB;AAE7E,OAAO,MAAMD,gBAA2C,GAAG,QAG9B;EAAA,IAH+B;IAC1DE,QAAQ;IACRC;EACqB,CAAC;EACtB,MAAMC,oBAAoB,GAAG;IAC3B,GAAID,cAAkD;IACtDE,GAAG,EAAEF,cAAc,CAACG;EACtB,CAAC;EACD;EACA,OAAOH,cAAc,CAACG,OAAO;EAC7B,oBACE,oBAAC,oBAAoB,EAAKF,oBAAoB,eAC5C,oBAAC,SAAS,QAAEF,QAAQ,CAAa,CACZ;AAE3B,CAAC"}
|
package/esm/state/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["atom","useRecoilState","persistAtom","useAuthState","authState","key","default","effects"],"sources":["../../src/state/index.ts"],"sourcesContent":["/**\n * File: /src/state/index.ts\n * Project: app\n * File Created: 22-11-2022 17:40:53\n * Author: Clay Risser\n * -----\n * Last Modified: 01-02-2023 14:38:51\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { atom, useRecoilState } from \"recoil\";\nimport { persistAtom } from \"multiplatform.one/recoil\";\n\nexport function useAuthState() {\n return useRecoilState(authState);\n}\n\nexport const authState = atom<{ token?: string; refreshToken?: string }>({\n key: \"auth\",\n default: {},\n effects: [persistAtom],\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,cAAc,QAAQ,QAAQ;AAC7C,SAASC,WAAW,QAAQ,0BAA0B;AAEtD,OAAO,SAASC,YAAY,GAAG;EAC7B,OAAOF,cAAc,CAACG,SAAS,CAAC;AAClC;AAEA,OAAO,MAAMA,SAAS,GAAGJ,IAAI,CAA4C;EACvEK,GAAG,EAAE,MAAM;EACXC,OAAO,EAAE,CAAC,CAAC;EACXC,OAAO,EAAE,CAACL,WAAW;AACvB,CAAC,CAAC"}
|
package/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * File: /src/types.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 25-11-2022 10:27:53\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 10:28:25\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\ndeclare global {\n interface Window {\n ReactNativeWebView: {\n postMessage: (body: string) => unknown;\n };\n webkit: {\n messageHandlers: {\n [key: string]: {\n postMessage: (body: string) => unknown;\n };\n };\n };\n }\n}\n\nexport default null;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,eAAe,IAAI"}
|
package/lib/Authenticated.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "react", "./hooks"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("react"), require("./hooks"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.react, global.hooks);
|
|
11
|
-
global.Authenticated = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _hooks) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
17
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
});
|
|
20
|
-
_exports.Authenticated = void 0;
|
|
21
|
-
_exports.withAuthenticated = withAuthenticated;
|
|
22
|
-
_react = _interopRequireDefault(_react);
|
|
23
|
-
/**
|
|
24
|
-
* File: /auth/Authenticated.tsx
|
|
25
|
-
* Project: app
|
|
26
|
-
* File Created: 08-11-2022 05:58:23
|
|
27
|
-
* Author: Clay Risser
|
|
28
|
-
* -----
|
|
29
|
-
* Last Modified: 22-11-2022 06:26:38
|
|
30
|
-
* Modified By: Clay Risser
|
|
31
|
-
* -----
|
|
32
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
33
|
-
*
|
|
34
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
35
|
-
* you may not use this file except in compliance with the License.
|
|
36
|
-
* You may obtain a copy of the License at
|
|
37
|
-
*
|
|
38
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
39
|
-
*
|
|
40
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
41
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
42
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
-
* See the License for the specific language governing permissions and
|
|
44
|
-
* limitations under the License.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
const Authenticated = props => {
|
|
48
|
-
const {
|
|
49
|
-
authenticated
|
|
50
|
-
} = (0, _hooks.useKeycloak)();
|
|
51
|
-
const login = (0, _hooks.useLogin)(props.loginRoute);
|
|
52
|
-
if (!props.disabled && !authenticated) {
|
|
53
|
-
if (authenticated === false) login();
|
|
54
|
-
const LoggedOutComponent = props.loggedOutComponent || (() => null);
|
|
55
|
-
return /*#__PURE__*/_react.default.createElement(LoggedOutComponent, null);
|
|
56
|
-
}
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
|
|
58
|
-
};
|
|
59
|
-
_exports.Authenticated = Authenticated;
|
|
60
|
-
function withAuthenticated(Component) {
|
|
61
|
-
return props => /*#__PURE__*/_react.default.createElement(Authenticated, null, /*#__PURE__*/_react.default.createElement(Component, props));
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=Authenticated.js.map
|
package/lib/Authenticated.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Authenticated.js","names":["Authenticated","props","authenticated","useKeycloak","login","useLogin","loginRoute","disabled","LoggedOutComponent","loggedOutComponent","children","withAuthenticated","Component"],"sources":["../src/Authenticated.tsx"],"sourcesContent":["/**\n * File: /auth/Authenticated.tsx\n * Project: app\n * File Created: 08-11-2022 05:58:23\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 06:26:38\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, { ComponentType, FC, ReactNode } from \"react\";\nimport { useLogin, useKeycloak } from \"./hooks\";\n\nexport interface AuthenticatedProps {\n children: ReactNode;\n disabled?: boolean;\n loggedOutComponent?: ComponentType;\n loginRoute?: string;\n}\n\nexport const Authenticated: FC<AuthenticatedProps> = (\n props: AuthenticatedProps\n) => {\n const { authenticated } = useKeycloak();\n const login = useLogin(props.loginRoute);\n if (!props.disabled && !authenticated) {\n if (authenticated === false) login();\n const LoggedOutComponent = props.loggedOutComponent || (() => null);\n return <LoggedOutComponent />;\n }\n return <>{props.children}</>;\n};\n\nexport function withAuthenticated<P extends object>(\n Component: ComponentType<P>\n) {\n return (props: P) => (\n <Authenticated>\n <Component {...props} />\n </Authenticated>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAYO,MAAMA,aAAqC,GAChDC,KAAyB,IACtB;IACH,MAAM;MAAEC;IAAc,CAAC,GAAG,IAAAC,kBAAW,GAAE;IACvC,MAAMC,KAAK,GAAG,IAAAC,eAAQ,EAACJ,KAAK,CAACK,UAAU,CAAC;IACxC,IAAI,CAACL,KAAK,CAACM,QAAQ,IAAI,CAACL,aAAa,EAAE;MACrC,IAAIA,aAAa,KAAK,KAAK,EAAEE,KAAK,EAAE;MACpC,MAAMI,kBAAkB,GAAGP,KAAK,CAACQ,kBAAkB,KAAK,MAAM,IAAI,CAAC;MACnE,oBAAO,6BAAC,kBAAkB,OAAG;IAC/B;IACA,oBAAO,4DAAGR,KAAK,CAACS,QAAQ,CAAI;EAC9B,CAAC;EAAC;EAEK,SAASC,iBAAiB,CAC/BC,SAA2B,EAC3B;IACA,OAAQX,KAAQ,iBACd,6BAAC,aAAa,qBACZ,6BAAC,SAAS,EAAKA,KAAK,CAAI,CAE3B;EACH;AAAC"}
|
package/lib/authConfig.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "react"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("react"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.react);
|
|
11
|
-
global.authConfig = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
_exports.defaultAuthConfig = _exports.AuthConfigContext = void 0;
|
|
20
|
-
/**
|
|
21
|
-
* File: /src/authConfig.ts
|
|
22
|
-
* Project: app
|
|
23
|
-
* File Created: 08-11-2022 09:21:15
|
|
24
|
-
* Author: Clay Risser
|
|
25
|
-
* -----
|
|
26
|
-
* Last Modified: 25-11-2022 10:29:29
|
|
27
|
-
* Modified By: Clay Risser
|
|
28
|
-
* -----
|
|
29
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
30
|
-
*
|
|
31
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
32
|
-
* you may not use this file except in compliance with the License.
|
|
33
|
-
* You may obtain a copy of the License at
|
|
34
|
-
*
|
|
35
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
-
*
|
|
37
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
38
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
39
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
40
|
-
* See the License for the specific language governing permissions and
|
|
41
|
-
* limitations under the License.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
const defaultAuthConfig = {
|
|
45
|
-
ssr: true
|
|
46
|
-
};
|
|
47
|
-
_exports.defaultAuthConfig = defaultAuthConfig;
|
|
48
|
-
const AuthConfigContext = /*#__PURE__*/(0, _react.createContext)(defaultAuthConfig);
|
|
49
|
-
_exports.AuthConfigContext = AuthConfigContext;
|
|
50
|
-
});
|
|
51
|
-
//# sourceMappingURL=authConfig.js.map
|
package/lib/authConfig.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authConfig.js","names":["defaultAuthConfig","ssr","AuthConfigContext","createContext"],"sources":["../src/authConfig.ts"],"sourcesContent":["/**\n * File: /src/authConfig.ts\n * Project: app\n * File Created: 08-11-2022 09:21:15\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 10:29:29\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 { createContext } from \"react\";\n\nexport const defaultAuthConfig: AuthConfig = {\n ssr: true,\n};\n\nexport const AuthConfigContext = createContext<AuthConfig>(defaultAuthConfig);\n\nexport interface AuthConfig {\n debug?: boolean;\n loginRoute?: string;\n messageHandlerKeys?: string[];\n ssr?: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAIO,MAAMA,iBAA6B,GAAG;IAC3CC,GAAG,EAAE;EACP,CAAC;EAAC;EAEK,MAAMC,iBAAiB,gBAAG,IAAAC,oBAAa,EAAaH,iBAAiB,CAAC;EAAC;AAAA"}
|
package/lib/hooks/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "./useCurrentRouteName", "./useKeycloak", "./useLogin"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("./useCurrentRouteName"), require("./useKeycloak"), require("./useLogin"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.useCurrentRouteName, global.useKeycloak, global.useLogin);
|
|
11
|
-
global.index = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _useCurrentRouteName, _useKeycloak, _useLogin) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
Object.keys(_useCurrentRouteName).forEach(function (key) {
|
|
20
|
-
if (key === "default" || key === "__esModule") return;
|
|
21
|
-
if (key in _exports && _exports[key] === _useCurrentRouteName[key]) return;
|
|
22
|
-
Object.defineProperty(_exports, key, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return _useCurrentRouteName[key];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
Object.keys(_useKeycloak).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in _exports && _exports[key] === _useKeycloak[key]) return;
|
|
32
|
-
Object.defineProperty(_exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _useKeycloak[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
Object.keys(_useLogin).forEach(function (key) {
|
|
40
|
-
if (key === "default" || key === "__esModule") return;
|
|
41
|
-
if (key in _exports && _exports[key] === _useLogin[key]) return;
|
|
42
|
-
Object.defineProperty(_exports, key, {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _useLogin[key];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/hooks/index.ts"],"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: 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\nexport * from \"./useCurrentRouteName\";\nexport * from \"./useKeycloak\";\nexport * from \"./useLogin\";\n"],"mappings":";;;;;;;;;;;;;;;;;;EAwBA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;AAA2B"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "react", "../authConfig"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("react"), require("../authConfig"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.react, global.authConfig);
|
|
11
|
-
global.useAuthConfig = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _authConfig) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
_exports.useAuthConfig = useAuthConfig;
|
|
20
|
-
/**
|
|
21
|
-
* File: /src/hooks/useAuthConfig.ts
|
|
22
|
-
* Project: app
|
|
23
|
-
* File Created: 08-11-2022 09:20:41
|
|
24
|
-
* Author: Clay Risser
|
|
25
|
-
* -----
|
|
26
|
-
* Last Modified: 25-11-2022 09:52:31
|
|
27
|
-
* Modified By: Clay Risser
|
|
28
|
-
* -----
|
|
29
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
30
|
-
*
|
|
31
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
32
|
-
* you may not use this file except in compliance with the License.
|
|
33
|
-
* You may obtain a copy of the License at
|
|
34
|
-
*
|
|
35
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
-
*
|
|
37
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
38
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
39
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
40
|
-
* See the License for the specific language governing permissions and
|
|
41
|
-
* limitations under the License.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
function useAuthConfig() {
|
|
45
|
-
return (0, _react.useContext)(_authConfig.AuthConfigContext);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=useAuthConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthConfig.js","names":["useAuthConfig","useContext","AuthConfigContext"],"sources":["../../src/hooks/useAuthConfig.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAKO,SAASA,aAAa,GAAG;IAC9B,OAAO,IAAAC,iBAAU,EAACC,6BAAiB,CAAC;EACtC;AAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "multiplatform.one", "@react-navigation/native", "next/router"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("multiplatform.one"), require("@react-navigation/native"), require("next/router"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.multiplatform, global.native, global.router);
|
|
11
|
-
global.useCurrentRouteName = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _multiplatform, _native, _router) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
_exports.useCurrentRouteName = useCurrentRouteName;
|
|
20
|
-
/**
|
|
21
|
-
* File: /src/hooks/useCurrentRouteName.ts
|
|
22
|
-
* Project: app
|
|
23
|
-
* File Created: 08-11-2022 08:38:23
|
|
24
|
-
* Author: Clay Risser
|
|
25
|
-
* -----
|
|
26
|
-
* Last Modified: 28-01-2023 13:47:18
|
|
27
|
-
* Modified By: Clay Risser
|
|
28
|
-
* -----
|
|
29
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
30
|
-
*
|
|
31
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
32
|
-
* you may not use this file except in compliance with the License.
|
|
33
|
-
* You may obtain a copy of the License at
|
|
34
|
-
*
|
|
35
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
-
*
|
|
37
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
38
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
39
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
40
|
-
* See the License for the specific language governing permissions and
|
|
41
|
-
* limitations under the License.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
function useCurrentRouteName() {
|
|
45
|
-
if (_multiplatform.MultiPlatform.isStorybook) return null;
|
|
46
|
-
if (_multiplatform.MultiPlatform.isNext) {
|
|
47
|
-
const router = (0, _router.useRouter)();
|
|
48
|
-
return router.route;
|
|
49
|
-
}
|
|
50
|
-
const route = (0, _native.useRoute)();
|
|
51
|
-
return route.name;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=useCurrentRouteName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentRouteName.js","names":["useCurrentRouteName","MultiPlatform","isStorybook","isNext","router","useRouter","route","useRoute","name"],"sources":["../../src/hooks/useCurrentRouteName.ts"],"sourcesContent":["/**\n * File: /src/hooks/useCurrentRouteName.ts\n * Project: app\n * File Created: 08-11-2022 08:38:23\n * Author: Clay Risser\n * -----\n * Last Modified: 28-01-2023 13:47:18\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 { 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"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAMO,SAASA,mBAAmB,GAAG;IACpC,IAAIC,4BAAa,CAACC,WAAW,EAAE,OAAO,IAAI;IAC1C,IAAID,4BAAa,CAACE,MAAM,EAAE;MACxB,MAAMC,MAAM,GAAG,IAAAC,iBAAS,GAAE;MAC1B,OAAOD,MAAM,CAACE,KAAK;IACrB;IACA,MAAMA,KAAK,GAAG,IAAAC,gBAAQ,GAAE;IACxB,OAAOD,KAAK,CAACE,IAAI;EACnB;AAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
if (typeof define === "function" && define.amd) {
|
|
3
|
-
define(["exports", "./useKeycloak"], factory);
|
|
4
|
-
} else if (typeof exports !== "undefined") {
|
|
5
|
-
factory(exports, require("./useKeycloak"));
|
|
6
|
-
} else {
|
|
7
|
-
var mod = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
factory(mod.exports, global.useKeycloak);
|
|
11
|
-
global.index = mod.exports;
|
|
12
|
-
}
|
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _useKeycloak) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
Object.keys(_useKeycloak).forEach(function (key) {
|
|
20
|
-
if (key === "default" || key === "__esModule") return;
|
|
21
|
-
if (key in _exports && _exports[key] === _useKeycloak[key]) return;
|
|
22
|
-
Object.defineProperty(_exports, key, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return _useKeycloak[key];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useKeycloak/index.ts"],"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: 28-11-2022 14:56:28\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 {\n KeycloakResourceAccess,\n KeycloakRoles,\n KeycloakTokenParsed,\n} from \"keycloak-js\";\nexport * from \"./useKeycloak\";\n\nexport interface IKeycloak {\n authenticated?: boolean;\n realmAccess?: KeycloakRoles;\n refreshToken?: string;\n refreshTokenParsed?: KeycloakTokenParsed;\n resourceAccess?: KeycloakResourceAccess;\n subject?: string;\n token?: string;\n tokenParsed?: KeycloakTokenParsed;\n login: () => Promise<unknown> | unknown;\n logout: () => Promise<unknown> | unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;EA6BA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;AAA8B"}
|