@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
package/esm/Authenticated.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /auth/Authenticated.tsx
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 05:58:23
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 22-11-2022 06:26:38
|
|
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 { useLogin, useKeycloak } from "./hooks";
|
|
27
|
-
export const Authenticated = props => {
|
|
28
|
-
const {
|
|
29
|
-
authenticated
|
|
30
|
-
} = useKeycloak();
|
|
31
|
-
const login = useLogin(props.loginRoute);
|
|
32
|
-
if (!props.disabled && !authenticated) {
|
|
33
|
-
if (authenticated === false) login();
|
|
34
|
-
const LoggedOutComponent = props.loggedOutComponent || (() => null);
|
|
35
|
-
return /*#__PURE__*/React.createElement(LoggedOutComponent, null);
|
|
36
|
-
}
|
|
37
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
|
|
38
|
-
};
|
|
39
|
-
export function withAuthenticated(Component) {
|
|
40
|
-
return props => /*#__PURE__*/React.createElement(Authenticated, null, /*#__PURE__*/React.createElement(Component, props));
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=Authenticated.js.map
|
package/esm/Authenticated.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Authenticated.js","names":["React","useLogin","useKeycloak","Authenticated","props","authenticated","login","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":"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,MAAwC,OAAO;AAC3D,SAASC,QAAQ,EAAEC,WAAW;AAS9B,OAAO,MAAMC,aAAqC,GAChDC,KAAyB,IACtB;EACH,MAAM;IAAEC;EAAc,CAAC,GAAGH,WAAW,EAAE;EACvC,MAAMI,KAAK,GAAGL,QAAQ,CAACG,KAAK,CAACG,UAAU,CAAC;EACxC,IAAI,CAACH,KAAK,CAACI,QAAQ,IAAI,CAACH,aAAa,EAAE;IACrC,IAAIA,aAAa,KAAK,KAAK,EAAEC,KAAK,EAAE;IACpC,MAAMG,kBAAkB,GAAGL,KAAK,CAACM,kBAAkB,KAAK,MAAM,IAAI,CAAC;IACnE,oBAAO,oBAAC,kBAAkB,OAAG;EAC/B;EACA,oBAAO,0CAAGN,KAAK,CAACO,QAAQ,CAAI;AAC9B,CAAC;AAED,OAAO,SAASC,iBAAiB,CAC/BC,SAA2B,EAC3B;EACA,OAAQT,KAAQ,iBACd,oBAAC,aAAa,qBACZ,oBAAC,SAAS,EAAKA,KAAK,CAAI,CAE3B;AACH"}
|
package/esm/authConfig.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/authConfig.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 09:21:15
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 25-11-2022 10:29:29
|
|
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 { createContext } from "react";
|
|
26
|
-
export const defaultAuthConfig = {
|
|
27
|
-
ssr: true
|
|
28
|
-
};
|
|
29
|
-
export const AuthConfigContext = /*#__PURE__*/createContext(defaultAuthConfig);
|
|
30
|
-
//# sourceMappingURL=authConfig.js.map
|
package/esm/authConfig.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authConfig.js","names":["createContext","defaultAuthConfig","ssr","AuthConfigContext"],"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":"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,aAAa,QAAQ,OAAO;AAErC,OAAO,MAAMC,iBAA6B,GAAG;EAC3CC,GAAG,EAAE;AACP,CAAC;AAED,OAAO,MAAMC,iBAAiB,gBAAGH,aAAa,CAAaC,iBAAiB,CAAC"}
|
package/esm/hooks/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/index.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 06:34:56
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 25-11-2022 09:52:31
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export * from "./useCurrentRouteName";
|
|
26
|
-
export * from "./useKeycloak";
|
|
27
|
-
export * from "./useLogin";
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
package/esm/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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useAuthConfig.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 09:20:41
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 25-11-2022 09:52:31
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { useContext } from "react";
|
|
26
|
-
import { AuthConfigContext } from "../authConfig";
|
|
27
|
-
export function useAuthConfig() {
|
|
28
|
-
return useContext(AuthConfigContext);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=useAuthConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthConfig.js","names":["useContext","AuthConfigContext","useAuthConfig"],"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":"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,UAAU,QAAQ,OAAO;AAClC,SAASC,iBAAiB;AAE1B,OAAO,SAASC,aAAa,GAAG;EAC9B,OAAOF,UAAU,CAACC,iBAAiB,CAAC;AACtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentRouteName.js","names":["MultiPlatform","useRoute","useRouter","useCurrentRouteName","isStorybook","isNext","router","route","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":"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,aAAa,QAAQ,mBAAmB;AACjD,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,mBAAmB,GAAG;EACpC,IAAIH,aAAa,CAACI,WAAW,EAAE,OAAO,IAAI;EAC1C,IAAIJ,aAAa,CAACK,MAAM,EAAE;IACxB,MAAMC,MAAM,GAAGJ,SAAS,EAAE;IAC1B,OAAOI,MAAM,CAACC,KAAK;EACrB;EACA,MAAMA,KAAK,GAAGN,QAAQ,EAAE;EACxB,OAAOM,KAAK,CAACC,IAAI;AACnB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useKeycloak/index.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 14:10:44
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 28-11-2022 14:56:28
|
|
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
|
-
export * from "./useKeycloak";
|
|
26
|
-
export {};
|
|
27
|
-
//# 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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AAA8B"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useKeycloak/useKeycloak.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 06:04:59
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 28-01-2023 13:48:24
|
|
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 { MultiPlatform } from "multiplatform.one";
|
|
26
|
-
import { useKeycloak as useReactKeycloak } from "@react-keycloak/web";
|
|
27
|
-
import { useKeycloak as useSsrKeycloak } from "@react-keycloak/ssr";
|
|
28
|
-
import { useAuthConfig } from "../useAuthConfig";
|
|
29
|
-
export function useKeycloak() {
|
|
30
|
-
const authConfig = useAuthConfig();
|
|
31
|
-
if (MultiPlatform.isStorybook) return {
|
|
32
|
-
authenticated: true
|
|
33
|
-
};
|
|
34
|
-
if (MultiPlatform.isNext && authConfig.ssr) {
|
|
35
|
-
const {
|
|
36
|
-
keycloak: ssrKeycloak,
|
|
37
|
-
initialized
|
|
38
|
-
} = useSsrKeycloak();
|
|
39
|
-
const keycloak = {
|
|
40
|
-
...ssrKeycloak
|
|
41
|
-
};
|
|
42
|
-
if (!initialized) keycloak.authenticated = undefined;
|
|
43
|
-
return keycloak;
|
|
44
|
-
}
|
|
45
|
-
const {
|
|
46
|
-
keycloak: reactKeycloak,
|
|
47
|
-
initialized
|
|
48
|
-
} = useReactKeycloak();
|
|
49
|
-
const keycloak = {
|
|
50
|
-
...reactKeycloak
|
|
51
|
-
};
|
|
52
|
-
if (!initialized) keycloak.authenticated = undefined;
|
|
53
|
-
return keycloak;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=useKeycloak.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useKeycloak.js","names":["MultiPlatform","useKeycloak","useReactKeycloak","useSsrKeycloak","useAuthConfig","authConfig","isStorybook","authenticated","isNext","ssr","keycloak","ssrKeycloak","initialized","undefined","reactKeycloak"],"sources":["../../../src/hooks/useKeycloak/useKeycloak.ts"],"sourcesContent":["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 28-01-2023 13:48:24\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 from \"keycloak-js\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { useKeycloak as useReactKeycloak } from \"@react-keycloak/web\";\nimport { useKeycloak as useSsrKeycloak } from \"@react-keycloak/ssr\";\nimport { IKeycloak } from \"./index\";\nimport { useAuthConfig } from \"../useAuthConfig\";\n\nexport function useKeycloak() {\n const authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n if (MultiPlatform.isNext && authConfig.ssr) {\n const { keycloak: ssrKeycloak, initialized } = useSsrKeycloak();\n const keycloak = { ...ssrKeycloak } as Keycloak;\n if (!initialized) keycloak.authenticated = undefined;\n return keycloak as IKeycloak;\n }\n const { keycloak: reactKeycloak, initialized } = useReactKeycloak();\n const keycloak = { ...reactKeycloak } as Keycloak;\n if (!initialized) keycloak.authenticated = undefined;\n return keycloak as IKeycloak;\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;;AAGA,SAASA,aAAa,QAAQ,mBAAmB;AACjD,SAASC,WAAW,IAAIC,gBAAgB,QAAQ,qBAAqB;AACrE,SAASD,WAAW,IAAIE,cAAc,QAAQ,qBAAqB;AAEnE,SAASC,aAAa;AAEtB,OAAO,SAASH,WAAW,GAAG;EAC5B,MAAMI,UAAU,GAAGD,aAAa,EAAE;EAClC,IAAIJ,aAAa,CAACM,WAAW,EAAE,OAAO;IAAEC,aAAa,EAAE;EAAK,CAAC;EAC7D,IAAIP,aAAa,CAACQ,MAAM,IAAIH,UAAU,CAACI,GAAG,EAAE;IAC1C,MAAM;MAAEC,QAAQ,EAAEC,WAAW;MAAEC;IAAY,CAAC,GAAGT,cAAc,EAAE;IAC/D,MAAMO,QAAQ,GAAG;MAAE,GAAGC;IAAY,CAAa;IAC/C,IAAI,CAACC,WAAW,EAAEF,QAAQ,CAACH,aAAa,GAAGM,SAAS;IACpD,OAAOH,QAAQ;EACjB;EACA,MAAM;IAAEA,QAAQ,EAAEI,aAAa;IAAEF;EAAY,CAAC,GAAGV,gBAAgB,EAAE;EACnE,MAAMQ,QAAQ,GAAG;IAAE,GAAGI;EAAc,CAAa;EACjD,IAAI,CAACF,WAAW,EAAEF,QAAQ,CAACH,aAAa,GAAGM,SAAS;EACpD,OAAOH,QAAQ;AACjB"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File: /src/hooks/useKeycloak/useKeycloak.native.ts
|
|
3
|
-
* Project: app
|
|
4
|
-
* File Created: 08-11-2022 14:10:25
|
|
5
|
-
* Author: Clay Risser
|
|
6
|
-
* -----
|
|
7
|
-
* Last Modified: 28-01-2023 13:47:33
|
|
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 atob from "core-js-pure/stable/atob";
|
|
26
|
-
import escape from "core-js-pure/stable/escape";
|
|
27
|
-
import { MultiPlatform } from "multiplatform.one";
|
|
28
|
-
import { useKeycloak as useExpoKeycloak } from "expo-keycloak-auth";
|
|
29
|
-
export function useKeycloak() {
|
|
30
|
-
if (MultiPlatform.isStorybook) return {
|
|
31
|
-
authenticated: true
|
|
32
|
-
};
|
|
33
|
-
const {
|
|
34
|
-
ready,
|
|
35
|
-
login,
|
|
36
|
-
isLoggedIn,
|
|
37
|
-
token,
|
|
38
|
-
logout,
|
|
39
|
-
refreshToken
|
|
40
|
-
} = useExpoKeycloak();
|
|
41
|
-
const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);
|
|
42
|
-
return keycloak;
|
|
43
|
-
}
|
|
44
|
-
export class ExpoKeycloak {
|
|
45
|
-
constructor(ready, isLoggedIn, login, logout, token, refreshToken) {
|
|
46
|
-
this.logout = logout;
|
|
47
|
-
this.token = token;
|
|
48
|
-
this.refreshToken = refreshToken;
|
|
49
|
-
this.authenticated = void 0;
|
|
50
|
-
this.tokenParsed = void 0;
|
|
51
|
-
this.refreshTokenParsed = void 0;
|
|
52
|
-
this.subject = void 0;
|
|
53
|
-
this.realmAccess = void 0;
|
|
54
|
-
this.resourceAccess = void 0;
|
|
55
|
-
this.login = void 0;
|
|
56
|
-
if (ready) this.authenticated = isLoggedIn;
|
|
57
|
-
if (this.authenticated) {
|
|
58
|
-
if (this.token) this.tokenParsed = decodeToken(this.token);
|
|
59
|
-
if (this.refreshToken) {
|
|
60
|
-
this.refreshTokenParsed = decodeToken(this.refreshToken);
|
|
61
|
-
}
|
|
62
|
-
if (this.tokenParsed) {
|
|
63
|
-
this.subject = this.tokenParsed.sub;
|
|
64
|
-
this.realmAccess = this.tokenParsed.realm_access;
|
|
65
|
-
this.resourceAccess = this.tokenParsed.resource_access;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
this.login = () => login();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function decodeToken(str) {
|
|
72
|
-
str = str.split(".")[1];
|
|
73
|
-
str = str.replace(/-/g, "+");
|
|
74
|
-
str = str.replace(/_/g, "/");
|
|
75
|
-
switch (str.length % 4) {
|
|
76
|
-
case 0:
|
|
77
|
-
break;
|
|
78
|
-
case 2:
|
|
79
|
-
str += "==";
|
|
80
|
-
break;
|
|
81
|
-
case 3:
|
|
82
|
-
str += "=";
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
throw "Invalid token";
|
|
86
|
-
}
|
|
87
|
-
str = decodeURIComponent(escape(atob(str)));
|
|
88
|
-
str = JSON.parse(str);
|
|
89
|
-
return str;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=useKeycloak.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useKeycloak.native.js","names":["atob","escape","MultiPlatform","useKeycloak","useExpoKeycloak","isStorybook","authenticated","ready","login","isLoggedIn","token","logout","refreshToken","keycloak","ExpoKeycloak","undefined","constructor","tokenParsed","refreshTokenParsed","subject","realmAccess","resourceAccess","decodeToken","sub","realm_access","resource_access","str","split","replace","length","decodeURIComponent","JSON","parse"],"sources":["../../../src/hooks/useKeycloak/useKeycloak.native.ts"],"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: 28-01-2023 13:47:33\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 { AuthRequestPromptOptions, AuthSessionResult } from \"expo-auth-session\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport {\n KeycloakResourceAccess,\n KeycloakRoles,\n KeycloakTokenParsed,\n} from \"keycloak-js\";\nimport { useKeycloak as useExpoKeycloak } from \"expo-keycloak-auth\";\nimport { IKeycloak } from \"./index\";\n\nexport function useKeycloak() {\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n const { ready, login, isLoggedIn, token, logout, refreshToken } =\n useExpoKeycloak();\n const keycloak = new ExpoKeycloak(\n ready,\n isLoggedIn,\n login,\n logout,\n token || undefined,\n refreshToken || undefined\n );\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> | unknown;\n\n constructor(\n ready: boolean,\n isLoggedIn: boolean | undefined,\n login: (\n options?: AuthRequestPromptOptions\n ) => Promise<AuthSessionResult | undefined>,\n public logout: () => 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"],"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,IAAI,MAAM,0BAA0B;AAC3C,OAAOC,MAAM,MAAM,4BAA4B;AAE/C,SAASC,aAAa,QAAQ,mBAAmB;AAMjD,SAASC,WAAW,IAAIC,eAAe,QAAQ,oBAAoB;AAGnE,OAAO,SAASD,WAAW,GAAG;EAC5B,IAAID,aAAa,CAACG,WAAW,EAAE,OAAO;IAAEC,aAAa,EAAE;EAAK,CAAC;EAC7D,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAa,CAAC,GAC7DR,eAAe,EAAE;EACnB,MAAMS,QAAQ,GAAG,IAAIC,YAAY,CAC/BP,KAAK,EACLE,UAAU,EACVD,KAAK,EACLG,MAAM,EACND,KAAK,IAAIK,SAAS,EAClBH,YAAY,IAAIG,SAAS,CAC1B;EACD,OAAOF,QAAQ;AACjB;AAEA,OAAO,MAAMC,YAAY,CAAsB;EAe7CE,WAAW,CACTT,KAAc,EACdE,UAA+B,EAC/BD,KAE2C,EACpCG,MAAqB,EACrBD,KAAc,EACdE,YAAqB,EAC5B;IAAA,KAHOD,MAAqB,GAArBA,MAAqB;IAAA,KACrBD,KAAc,GAAdA,KAAc;IAAA,KACdE,YAAqB,GAArBA,YAAqB;IAAA,KAtB9BN,aAAa;IAAA,KAEbW,WAAW;IAAA,KAEXC,kBAAkB;IAAA,KAElBC,OAAO;IAAA,KAEPC,WAAW;IAAA,KAEXC,cAAc;IAAA,KAEdb,KAAK;IAYH,IAAID,KAAK,EAAE,IAAI,CAACD,aAAa,GAAGG,UAAU;IAC1C,IAAI,IAAI,CAACH,aAAa,EAAE;MACtB,IAAI,IAAI,CAACI,KAAK,EAAE,IAAI,CAACO,WAAW,GAAGK,WAAW,CAAC,IAAI,CAACZ,KAAK,CAAC;MAC1D,IAAI,IAAI,CAACE,YAAY,EAAE;QACrB,IAAI,CAACM,kBAAkB,GAAGI,WAAW,CAAC,IAAI,CAACV,YAAY,CAAC;MAC1D;MACA,IAAI,IAAI,CAACK,WAAW,EAAE;QACpB,IAAI,CAACE,OAAO,GAAG,IAAI,CAACF,WAAW,CAACM,GAAG;QACnC,IAAI,CAACH,WAAW,GAAG,IAAI,CAACH,WAAW,CAACO,YAAY;QAChD,IAAI,CAACH,cAAc,GAAG,IAAI,CAACJ,WAAW,CAACQ,eAAe;MACxD;IACF;IACA,IAAI,CAACjB,KAAK,GAAG,MAAMA,KAAK,EAAE;EAC5B;AACF;AAEA,SAASc,WAAW,CAACI,GAAW,EAAE;EAChCA,GAAG,GAAGA,GAAG,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EACvBD,GAAG,GAAGA,GAAG,CAACE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;EAC5BF,GAAG,GAAGA,GAAG,CAACE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;EAC5B,QAAQF,GAAG,CAACG,MAAM,GAAG,CAAC;IACpB,KAAK,CAAC;MACJ;IACF,KAAK,CAAC;MACJH,GAAG,IAAI,IAAI;MACX;IACF,KAAK,CAAC;MACJA,GAAG,IAAI,GAAG;MACV;IACF;MACE,MAAM,eAAe;EAAC;EAE1BA,GAAG,GAAGI,kBAAkB,CAAC7B,MAAM,CAACD,IAAI,CAAC0B,GAAG,CAAC,CAAC,CAAC;EAC3CA,GAAG,GAAGK,IAAI,CAACC,KAAK,CAACN,GAAG,CAAC;EACrB,OAAOA,GAAG;AACZ"}
|
package/esm/hooks/useLogin.js
DELETED
|
@@ -1,50 +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: 28-01-2023 13:47:42
|
|
8
|
-
* Modified By: Clay Risser
|
|
9
|
-
* -----
|
|
10
|
-
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { useRouter } from "solito/router";
|
|
26
|
-
import { MultiPlatform } from "multiplatform.one";
|
|
27
|
-
import { useCurrentRouteName } from "./useCurrentRouteName";
|
|
28
|
-
import { useKeycloak } from "./useKeycloak/useKeycloak";
|
|
29
|
-
import { useAuthConfig } from "./useAuthConfig";
|
|
30
|
-
export function useLogin(loginRoute) {
|
|
31
|
-
if (MultiPlatform.isStorybook) return () => null;
|
|
32
|
-
const keycloak = useKeycloak();
|
|
33
|
-
const authConfig = useAuthConfig();
|
|
34
|
-
const currentRouteName = useCurrentRouteName();
|
|
35
|
-
const router = useRouter();
|
|
36
|
-
return () => {
|
|
37
|
-
if (!loginRoute) loginRoute = authConfig.loginRoute;
|
|
38
|
-
if (!loginRoute) {
|
|
39
|
-
keycloak.login();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const url = new URL(`x://${loginRoute}`);
|
|
43
|
-
const searchParams = new URLSearchParams(url.search);
|
|
44
|
-
if (currentRouteName) searchParams.append("backTo", currentRouteName);
|
|
45
|
-
let query = searchParams.toString();
|
|
46
|
-
if (query.length) query = `?${query}`;
|
|
47
|
-
router.push(`${url.pathname.substring(2)}${query}`);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=useLogin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLogin.js","names":["useRouter","MultiPlatform","useCurrentRouteName","useKeycloak","useAuthConfig","useLogin","loginRoute","isStorybook","keycloak","authConfig","currentRouteName","router","login","url","URL","searchParams","URLSearchParams","search","append","query","toString","length","push","pathname","substring"],"sources":["../../src/hooks/useLogin.ts"],"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: 28-01-2023 13:47:42\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useRouter } from \"solito/router\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { useCurrentRouteName } from \"./useCurrentRouteName\";\nimport { useKeycloak } from \"./useKeycloak/useKeycloak\";\nimport { useAuthConfig } from \"./useAuthConfig\";\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"],"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,SAAS,QAAQ,eAAe;AACzC,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,mBAAmB;AAC5B,SAASC,WAAW;AACpB,SAASC,aAAa;AAEtB,OAAO,SAASC,QAAQ,CAACC,UAAmB,EAAE;EAC5C,IAAIL,aAAa,CAACM,WAAW,EAAE,OAAO,MAAM,IAAI;EAChD,MAAMC,QAAQ,GAAGL,WAAW,EAAE;EAC9B,MAAMM,UAAU,GAAGL,aAAa,EAAE;EAClC,MAAMM,gBAAgB,GAAGR,mBAAmB,EAAE;EAC9C,MAAMS,MAAM,GAAGX,SAAS,EAAE;EAC1B,OAAO,MAAM;IACX,IAAI,CAACM,UAAU,EAAEA,UAAU,GAAGG,UAAU,CAACH,UAAU;IACnD,IAAI,CAACA,UAAU,EAAE;MACfE,QAAQ,CAACI,KAAK,EAAE;MAChB;IACF;IACA,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAE,OAAMR,UAAW,EAAC,CAAC;IACxC,MAAMS,YAAY,GAAG,IAAIC,eAAe,CAACH,GAAG,CAACI,MAAM,CAAC;IACpD,IAAIP,gBAAgB,EAAEK,YAAY,CAACG,MAAM,CAAC,QAAQ,EAAER,gBAAgB,CAAC;IACrE,IAAIS,KAAK,GAAGJ,YAAY,CAACK,QAAQ,EAAE;IACnC,IAAID,KAAK,CAACE,MAAM,EAAEF,KAAK,GAAI,IAAGA,KAAM,EAAC;IACrCR,MAAM,CAACW,IAAI,CAAE,GAAET,GAAG,CAACU,QAAQ,CAACC,SAAS,CAAC,CAAC,CAAE,GAAEL,KAAM,EAAC,CAAC;EACrD,CAAC;AACH"}
|
package/esm/index.js
DELETED
|
@@ -1,29 +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
|
-
|
|
25
|
-
export * from "./Authenticated";
|
|
26
|
-
export * from "./authConfig";
|
|
27
|
-
export * from "./hooks";
|
|
28
|
-
export * from "./provider";
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"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"],"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;AACA;AACA;AACA"}
|
package/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "module"}
|
|
@@ -1,58 +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
|
-
|
|
25
|
-
import React, { useEffect } from "react";
|
|
26
|
-
import { useKeycloak } from "../hooks";
|
|
27
|
-
import { useAuthConfig } from "../hooks/useAuthConfig";
|
|
28
|
-
import { useAuthState } from "../state";
|
|
29
|
-
const logger = console;
|
|
30
|
-
export const AfterAuth = _ref => {
|
|
31
|
-
let {
|
|
32
|
-
children
|
|
33
|
-
} = _ref;
|
|
34
|
-
const authConfig = useAuthConfig();
|
|
35
|
-
const {
|
|
36
|
-
token,
|
|
37
|
-
refreshToken,
|
|
38
|
-
authenticated
|
|
39
|
-
} = useKeycloak();
|
|
40
|
-
const [, setAuth] = useAuthState();
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (!authenticated) return;
|
|
43
|
-
if (token) {
|
|
44
|
-
setAuth({
|
|
45
|
-
token,
|
|
46
|
-
...(refreshToken ? {
|
|
47
|
-
refreshToken
|
|
48
|
-
} : {})
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}, [token, refreshToken]);
|
|
52
|
-
if (authConfig.debug) {
|
|
53
|
-
logger.debug("authenticated", authenticated);
|
|
54
|
-
logger.debug("token", token);
|
|
55
|
-
}
|
|
56
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=afterAuth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"afterAuth.js","names":["React","useEffect","useKeycloak","useAuthConfig","useAuthState","logger","console","AfterAuth","children","authConfig","token","refreshToken","authenticated","setAuth","debug"],"sources":["../../src/provider/afterAuth.tsx"],"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, { FC, ReactNode, useEffect } from \"react\";\nimport { useKeycloak } from \"../hooks\";\nimport { useAuthConfig } from \"../hooks/useAuthConfig\";\nimport { useAuthState } from \"../state\";\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 { token, refreshToken, authenticated } = useKeycloak();\n const [, setAuth] = useAuthState();\n\n useEffect(() => {\n if (!authenticated) return;\n if (token) {\n setAuth({\n token,\n ...(refreshToken ? { refreshToken } : {}),\n });\n }\n }, [token, refreshToken]);\n\n if (authConfig.debug) {\n logger.debug(\"authenticated\", authenticated);\n logger.debug(\"token\", token);\n }\n return <>{children}</>;\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,IAAmBC,SAAS,QAAQ,OAAO;AACvD,SAASC,WAAW;AACpB,SAASC,aAAa;AACtB,SAASC,YAAY;AAMrB,MAAMC,MAAM,GAAGC,OAAO;AAEtB,OAAO,MAAMC,SAA6B,GAAG,QAAkC;EAAA,IAAjC;IAAEC;EAAyB,CAAC;EACxE,MAAMC,UAAU,GAAGN,aAAa,EAAE;EAClC,MAAM;IAAEO,KAAK;IAAEC,YAAY;IAAEC;EAAc,CAAC,GAAGV,WAAW,EAAE;EAC5D,MAAM,GAAGW,OAAO,CAAC,GAAGT,YAAY,EAAE;EAElCH,SAAS,CAAC,MAAM;IACd,IAAI,CAACW,aAAa,EAAE;IACpB,IAAIF,KAAK,EAAE;MACTG,OAAO,CAAC;QACNH,KAAK;QACL,IAAIC,YAAY,GAAG;UAAEA;QAAa,CAAC,GAAG,CAAC,CAAC;MAC1C,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACD,KAAK,EAAEC,YAAY,CAAC,CAAC;EAEzB,IAAIF,UAAU,CAACK,KAAK,EAAE;IACpBT,MAAM,CAACS,KAAK,CAAC,eAAe,EAAEF,aAAa,CAAC;IAC5CP,MAAM,CAACS,KAAK,CAAC,OAAO,EAAEJ,KAAK,CAAC;EAC9B;EACA,oBAAO,0CAAGF,QAAQ,CAAI;AACxB,CAAC"}
|
package/esm/provider/index.js
DELETED
|
@@ -1,43 +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
|
-
|
|
25
|
-
import React, { useMemo } from "react";
|
|
26
|
-
import { AuthConfigContext, defaultAuthConfig } from "../authConfig";
|
|
27
|
-
import { KeycloakProvider } from "./keycloakProvider";
|
|
28
|
-
export const AuthProvider = props => {
|
|
29
|
-
const {
|
|
30
|
-
authConfig,
|
|
31
|
-
debug
|
|
32
|
-
} = props;
|
|
33
|
-
const authConfigValue = useMemo(() => ({
|
|
34
|
-
...defaultAuthConfig,
|
|
35
|
-
...authConfig,
|
|
36
|
-
debug: !!debug
|
|
37
|
-
}), []);
|
|
38
|
-
return /*#__PURE__*/React.createElement(AuthConfigContext.Provider, {
|
|
39
|
-
value: authConfigValue
|
|
40
|
-
}, /*#__PURE__*/React.createElement(KeycloakProvider, props));
|
|
41
|
-
};
|
|
42
|
-
export * from "./keycloakProvider";
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","AuthConfigContext","defaultAuthConfig","KeycloakProvider","AuthProvider","props","authConfig","debug","authConfigValue"],"sources":["../../src/provider/index.tsx"],"sourcesContent":["/**\n * File: /auth/provider/index.tsx\n * Project: app\n * File Created: 08-11-2022 06:33:07\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:00:13\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { FC, useMemo } from \"react\";\nimport {\n AuthConfig,\n AuthConfigContext,\n defaultAuthConfig,\n} from \"../authConfig\";\nimport { KeycloakProvider, KeycloakProviderProps } from \"./keycloakProvider\";\n\nexport interface AuthProviderProps extends KeycloakProviderProps {\n authConfig?: Partial<AuthConfig>;\n}\n\nexport const AuthProvider: FC<AuthProviderProps> = (\n props: AuthProviderProps\n) => {\n const { authConfig, debug } = props;\n const authConfigValue = useMemo(\n () => ({\n ...defaultAuthConfig,\n ...authConfig,\n debug: !!debug,\n }),\n []\n );\n\n return (\n <AuthConfigContext.Provider value={authConfigValue}>\n <KeycloakProvider {...props} />\n </AuthConfigContext.Provider>\n );\n};\n\nexport * from \"./keycloakProvider\";\n"],"mappings":"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,IAAQC,OAAO,QAAQ,OAAO;AAC1C,SAEEC,iBAAiB,EACjBC,iBAAiB;AAEnB,SAASC,gBAAgB;AAMzB,OAAO,MAAMC,YAAmC,GAC9CC,KAAwB,IACrB;EACH,MAAM;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGF,KAAK;EACnC,MAAMG,eAAe,GAAGR,OAAO,CAC7B,OAAO;IACL,GAAGE,iBAAiB;IACpB,GAAGI,UAAU;IACbC,KAAK,EAAE,CAAC,CAACA;EACX,CAAC,CAAC,EACF,EAAE,CACH;EAED,oBACE,oBAAC,iBAAiB,CAAC,QAAQ;IAAC,KAAK,EAAEC;EAAgB,gBACjD,oBAAC,gBAAgB,EAAKH,KAAK,CAAI,CACJ;AAEjC,CAAC;AAED"}
|