@multiplatform.one/keycloak 0.7.15 → 0.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/@types/expoKeycloakAuth.d.js +1 -1
- package/lib/Authenticated.d.mts +2 -2
- package/lib/Authenticated.d.ts +2 -2
- package/lib/Authenticated.js +20 -19
- package/lib/Authenticated.mjs +13 -13
- package/lib/authConfig.d.mts +2 -4
- package/lib/authConfig.d.ts +2 -4
- package/lib/authConfig.js +9 -8
- package/lib/authConfig.mjs +2 -2
- package/lib/chunk-2BKS6UM5.js +51 -0
- package/lib/chunk-2BSUCVXL.js +50 -0
- package/lib/chunk-2L5TXBDK.mjs +7 -0
- package/lib/chunk-2VDDEPLF.js +27 -0
- package/lib/chunk-32AVT4GA.js +9 -0
- package/lib/chunk-3ZTSLDX7.js +13 -0
- package/lib/chunk-6F4PWJZI.js +1 -0
- package/lib/{chunk-7MTPH6XK.mjs → chunk-6FRYV4MK.mjs} +10 -9
- package/lib/chunk-A2V2S4HP.js +22 -0
- package/lib/chunk-BUZONXAW.js +1 -0
- package/lib/{chunk-BVB33X7V.mjs → chunk-CGLMLNUS.mjs} +61 -81
- package/lib/chunk-FU4CT24B.mjs +32 -0
- package/lib/{chunk-Y4XMF3R6.mjs → chunk-HTWZLBA4.mjs} +1 -1
- package/lib/chunk-I5FNGKQ6.js +16 -0
- package/lib/{chunk-64PPU7Q3.mjs → chunk-JAFUI2JQ.mjs} +1 -5
- package/lib/{chunk-NXTVYIBR.mjs → chunk-L3HTVJ4B.mjs} +2 -0
- package/lib/chunk-MDAAMGTE.js +1 -0
- package/lib/chunk-NH335CDK.js +32 -0
- package/lib/chunk-OA5TSQWZ.mjs +50 -0
- package/lib/chunk-OBB23GPX.mjs +0 -0
- package/lib/chunk-OZLV3US5.js +245 -0
- package/lib/chunk-P57PW2II.js +11 -0
- package/lib/chunk-TUJRPTZE.js +13 -0
- package/lib/chunk-UESWAK47.mjs +0 -0
- package/lib/chunk-UH4K7HGE.mjs +163 -0
- package/lib/{chunk-UOKDJT5L.mjs → chunk-UKSHA3X3.mjs} +2 -2
- package/lib/chunk-VS4M7GMO.js +1 -0
- package/lib/chunk-WBQAMGXK.mjs +0 -0
- package/lib/{chunk-AD6VPMID.mjs → chunk-WMH347OL.mjs} +5 -3
- package/lib/chunk-WS4IMGVL.js +1 -0
- package/lib/chunk-X53FOCXA.js +28 -0
- package/lib/chunk-Y23BWOII.mjs +51 -0
- package/lib/chunk-Y5MS3XVZ.mjs +28 -0
- package/lib/chunk-YACGLW5Q.js +7 -0
- package/lib/chunk-ZCBD6HWK.js +1 -0
- package/lib/chunk-ZFXKCRJC.mjs +11 -0
- package/lib/chunk-ZW4GP2I5.js +163 -0
- package/lib/hooks/index.d.mts +0 -4
- package/lib/hooks/index.d.ts +0 -4
- package/lib/hooks/index.js +19 -23
- package/lib/hooks/index.mjs +8 -23
- package/lib/hooks/useAuthConfig.js +8 -8
- package/lib/hooks/useAuthConfig.mjs +3 -3
- package/lib/hooks/useTokensFromQuery/index.js +7 -7
- package/lib/hooks/useTokensFromQuery/index.mjs +2 -2
- package/lib/hooks/useTokensFromQuery/index.native.js +5 -8
- package/lib/hooks/useTokensFromQuery/index.native.mjs +1 -1
- package/lib/hooks/useTokensFromState.js +9 -9
- package/lib/hooks/useTokensFromState.mjs +4 -4
- package/lib/index.d.mts +10 -7
- package/lib/index.d.ts +10 -7
- package/lib/index.js +62 -34
- package/lib/index.mjs +32 -26
- package/lib/keycloak/context.d.mts +12 -0
- package/lib/keycloak/context.d.ts +12 -0
- package/lib/keycloak/context.js +7 -0
- package/lib/keycloak/context.mjs +7 -0
- package/lib/keycloak/index.d.mts +7 -0
- package/lib/keycloak/index.d.ts +7 -0
- package/lib/keycloak/index.js +14 -0
- package/lib/keycloak/index.mjs +14 -0
- package/lib/keycloak/keycloak.d.mts +37 -0
- package/lib/keycloak/keycloak.d.ts +37 -0
- package/lib/keycloak/keycloak.js +13 -0
- package/lib/keycloak/keycloak.mjs +13 -0
- package/lib/keycloak/keycloak.native.d.mts +33 -0
- package/lib/keycloak/keycloak.native.d.ts +33 -0
- package/lib/keycloak/keycloak.native.js +134 -0
- package/lib/keycloak/keycloak.native.mjs +134 -0
- package/lib/provider/{afterAuth.d.ts → AfterAuth.d.mts} +6 -7
- package/lib/provider/{afterAuth.d.mts → AfterAuth.d.ts} +6 -7
- package/lib/provider/AfterAuth.js +18 -0
- package/lib/provider/AfterAuth.mjs +18 -0
- package/lib/provider/AuthProvider/AuthProvider.d.mts +37 -0
- package/lib/provider/AuthProvider/AuthProvider.d.ts +37 -0
- package/lib/provider/AuthProvider/AuthProvider.js +19 -0
- package/lib/provider/AuthProvider/AuthProvider.mjs +19 -0
- package/lib/provider/{keycloakProvider.native.d.ts → AuthProvider/AuthProvider.native.d.mts} +9 -9
- package/lib/provider/{keycloakProvider.native.d.mts → AuthProvider/AuthProvider.native.d.ts} +9 -9
- package/lib/provider/AuthProvider/AuthProvider.native.js +25 -0
- package/lib/provider/AuthProvider/AuthProvider.native.mjs +25 -0
- package/lib/provider/AuthProvider/index.d.mts +4 -0
- package/lib/provider/AuthProvider/index.d.ts +4 -0
- package/lib/provider/AuthProvider/index.js +20 -0
- package/lib/provider/AuthProvider/index.mjs +20 -0
- package/lib/provider/KeycloakProvider.d.mts +34 -0
- package/lib/provider/KeycloakProvider.d.ts +34 -0
- package/lib/provider/KeycloakProvider.js +21 -0
- package/lib/provider/KeycloakProvider.mjs +21 -0
- package/lib/provider/index.d.mts +8 -39
- package/lib/provider/index.d.ts +8 -39
- package/lib/provider/index.js +28 -22
- package/lib/provider/index.mjs +22 -19
- package/lib/routes.d.mts +28 -0
- package/lib/routes.d.ts +28 -0
- package/lib/routes.js +127 -0
- package/lib/routes.mjs +127 -0
- package/lib/session/index.d.mts +3 -0
- package/lib/session/index.d.ts +3 -0
- package/lib/session/index.js +10 -0
- package/lib/session/index.mjs +10 -0
- package/lib/session/session.d.mts +18 -0
- package/lib/session/session.d.ts +18 -0
- package/lib/session/session.js +9 -0
- package/lib/session/session.mjs +9 -0
- package/lib/session/session.native.d.mts +8 -0
- package/lib/session/session.native.d.ts +8 -0
- package/lib/session/session.native.js +13 -0
- package/lib/session/session.native.mjs +13 -0
- package/lib/{state/index.d.ts → state.d.mts} +2 -1
- package/lib/{state/index.d.mts → state.d.ts} +2 -1
- package/lib/state.js +9 -0
- package/lib/state.mjs +9 -0
- package/lib/token.d.mts +17 -0
- package/lib/token.d.ts +17 -0
- package/lib/token.js +9 -0
- package/lib/{util.mjs → token.mjs} +2 -2
- package/lib/types.d.mts +5 -2
- package/lib/types.d.ts +5 -2
- package/lib/types.js +1 -8
- package/lib/types.mjs +1 -7
- package/package.json +28 -28
- package/routes/index.d.ts +22 -0
- package/routes/index.js +22 -0
- package/src/Authenticated.tsx +27 -17
- package/src/authConfig.ts +3 -9
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useTokensFromQuery/index.ts +1 -0
- package/src/hooks/useTokensFromState.ts +1 -1
- package/src/index.ts +3 -0
- package/src/{@types/coreJsPure.d.ts → keycloak/context.ts} +6 -11
- package/src/{hooks/useCurrentRouteName/index.native.ts → keycloak/index.ts} +4 -11
- package/src/keycloak/keycloak.native.ts +148 -0
- package/src/keycloak/keycloak.ts +175 -0
- package/src/provider/AfterAuth.tsx +63 -0
- package/src/provider/{keycloakProvider.native.tsx → AuthProvider/AuthProvider.native.tsx} +8 -16
- package/src/provider/{keycloakProvider.tsx → AuthProvider/AuthProvider.tsx} +81 -94
- package/src/provider/AuthProvider/index.ts +22 -0
- package/src/provider/KeycloakProvider.tsx +53 -0
- package/src/provider/index.ts +24 -0
- package/src/routes.ts +163 -0
- package/src/session/index.ts +22 -0
- package/src/{hooks/useCurrentRouteName/index.ts → session/session.native.ts} +11 -14
- package/src/session/session.ts +68 -0
- package/src/{state/index.ts → state.ts} +5 -4
- package/src/{util.ts → token.ts} +25 -11
- package/src/types.ts +4 -1
- package/lib/@types/coreJsPure.d.d.mts +0 -2
- package/lib/@types/coreJsPure.d.d.ts +0 -2
- package/lib/@types/coreJsPure.d.js +0 -1
- package/lib/chunk-3ZPHNEJL.js +0 -11
- package/lib/chunk-6NDWOV55.js +0 -1
- package/lib/chunk-A7UBOIAL.js +0 -13
- package/lib/chunk-AUUZ6BI7.js +0 -78
- package/lib/chunk-C2FNSVJO.js +0 -17
- package/lib/chunk-J4CCMILN.mjs +0 -41
- package/lib/chunk-K33RKJZX.js +0 -443
- package/lib/chunk-KLLABHIC.js +0 -13
- package/lib/chunk-L5HMOY4M.mjs +0 -18
- package/lib/chunk-MZ6E62HK.js +0 -33
- package/lib/chunk-NWRANDZ6.js +0 -98
- package/lib/chunk-OYWAYMFN.js +0 -17
- package/lib/chunk-RPUOO7AV.mjs +0 -10
- package/lib/chunk-RYM7KERK.mjs +0 -52
- package/lib/chunk-UBVYEZI3.js +0 -1
- package/lib/chunk-UHTKOFS6.mjs +0 -84
- package/lib/chunk-UL6L5ONI.js +0 -460
- package/lib/chunk-W5DJLFTQ.js +0 -56
- package/lib/chunk-WT5W6BSZ.js +0 -161
- package/lib/chunk-XEO3YXBM.js +0 -22
- package/lib/chunk-XO4W2SMN.mjs +0 -50
- package/lib/chunk-XVPWAAZ4.mjs +0 -76
- package/lib/chunk-YGNNHTFE.js +0 -12
- package/lib/hooks/useCurrentRouteName/index.d.mts +0 -3
- package/lib/hooks/useCurrentRouteName/index.d.ts +0 -3
- package/lib/hooks/useCurrentRouteName/index.js +0 -7
- package/lib/hooks/useCurrentRouteName/index.mjs +0 -7
- package/lib/hooks/useCurrentRouteName/index.native.d.mts +0 -3
- package/lib/hooks/useCurrentRouteName/index.native.d.ts +0 -3
- package/lib/hooks/useCurrentRouteName/index.native.js +0 -14
- package/lib/hooks/useCurrentRouteName/index.native.mjs +0 -14
- package/lib/hooks/useKeycloak/index.d.mts +0 -46
- package/lib/hooks/useKeycloak/index.d.ts +0 -46
- package/lib/hooks/useKeycloak/index.js +0 -11
- package/lib/hooks/useKeycloak/index.mjs +0 -12
- package/lib/hooks/useKeycloak/useKeycloak.d.mts +0 -2
- package/lib/hooks/useKeycloak/useKeycloak.d.ts +0 -2
- package/lib/hooks/useKeycloak/useKeycloak.js +0 -10
- package/lib/hooks/useKeycloak/useKeycloak.mjs +0 -11
- package/lib/hooks/useKeycloak/useKeycloak.native.d.mts +0 -20
- package/lib/hooks/useKeycloak/useKeycloak.native.d.ts +0 -20
- package/lib/hooks/useKeycloak/useKeycloak.native.js +0 -80
- package/lib/hooks/useKeycloak/useKeycloak.native.mjs +0 -69
- package/lib/hooks/useLogin.d.mts +0 -3
- package/lib/hooks/useLogin.d.ts +0 -3
- package/lib/hooks/useLogin.js +0 -11
- package/lib/hooks/useLogin.mjs +0 -11
- package/lib/provider/afterAuth.js +0 -18
- package/lib/provider/afterAuth.mjs +0 -18
- package/lib/provider/keycloakProvider.d.mts +0 -42
- package/lib/provider/keycloakProvider.d.ts +0 -42
- package/lib/provider/keycloakProvider.js +0 -20
- package/lib/provider/keycloakProvider.mjs +0 -21
- package/lib/provider/keycloakProvider.native.js +0 -87
- package/lib/provider/keycloakProvider.native.mjs +0 -30
- package/lib/state/index.js +0 -7
- package/lib/state/index.mjs +0 -7
- package/lib/util.d.mts +0 -4
- package/lib/util.d.ts +0 -4
- package/lib/util.js +0 -8
- package/src/hooks/useKeycloak/index.ts +0 -47
- package/src/hooks/useKeycloak/useKeycloak.native.ts +0 -95
- package/src/hooks/useKeycloak/useKeycloak.ts +0 -106
- package/src/hooks/useLogin.ts +0 -47
- package/src/provider/afterAuth.tsx +0 -65
- package/src/provider/index.tsx +0 -117
- /package/lib/{@types/coreJsPure.d.mjs → chunk-HH32BME2.mjs} +0 -0
- /package/lib/{chunk-2GUOEPFY.mjs → chunk-JPQI72HR.mjs} +0 -0
- /package/lib/{chunk-AYKQVWMR.mjs → chunk-OAUYHIWG.mjs} +0 -0
package/lib/chunk-WT5W6BSZ.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _define_property(obj, key, value) {
|
|
3
|
-
if (key in obj) {
|
|
4
|
-
Object.defineProperty(obj, key, {
|
|
5
|
-
value: value,
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true
|
|
9
|
-
});
|
|
10
|
-
} else {
|
|
11
|
-
obj[key] = value;
|
|
12
|
-
}
|
|
13
|
-
return obj;
|
|
14
|
-
}
|
|
15
|
-
function _object_spread(target) {
|
|
16
|
-
for(var i = 1; i < arguments.length; i++){
|
|
17
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
-
var ownKeys = Object.keys(source);
|
|
19
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
ownKeys.forEach(function(key) {
|
|
25
|
-
_define_property(target, key, source[key]);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
}
|
|
30
|
-
function ownKeys(object, enumerableOnly) {
|
|
31
|
-
var keys = Object.keys(object);
|
|
32
|
-
if (Object.getOwnPropertySymbols) {
|
|
33
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
-
if (enumerableOnly) {
|
|
35
|
-
symbols = symbols.filter(function(sym) {
|
|
36
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
keys.push.apply(keys, symbols);
|
|
40
|
-
}
|
|
41
|
-
return keys;
|
|
42
|
-
}
|
|
43
|
-
function _object_spread_props(target, source) {
|
|
44
|
-
source = source != null ? source : {};
|
|
45
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
46
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
|
-
} else {
|
|
48
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return target;
|
|
53
|
-
}
|
|
54
|
-
function _object_without_properties(source, excluded) {
|
|
55
|
-
if (source == null) return {};
|
|
56
|
-
var target = _object_without_properties_loose(source, excluded);
|
|
57
|
-
var key, i;
|
|
58
|
-
if (Object.getOwnPropertySymbols) {
|
|
59
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
60
|
-
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
61
|
-
key = sourceSymbolKeys[i];
|
|
62
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
63
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
64
|
-
target[key] = source[key];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return target;
|
|
68
|
-
}
|
|
69
|
-
function _object_without_properties_loose(source, excluded) {
|
|
70
|
-
if (source == null) return {};
|
|
71
|
-
var target = {};
|
|
72
|
-
var sourceKeys = Object.keys(source);
|
|
73
|
-
var key, i;
|
|
74
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
75
|
-
key = sourceKeys[i];
|
|
76
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
77
|
-
target[key] = source[key];
|
|
78
|
-
}
|
|
79
|
-
return target;
|
|
80
|
-
}
|
|
81
|
-
Object.defineProperty(exports, "__esModule", {
|
|
82
|
-
value: true
|
|
83
|
-
});
|
|
84
|
-
function _interopRequireDefault(obj) {
|
|
85
|
-
return obj && obj.__esModule ? obj : {
|
|
86
|
-
default: obj
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
var _chunkK33RKJZXjs = require("./chunk-K33RKJZX.js");
|
|
90
|
-
var _chunkKLLABHICjs = require("./chunk-KLLABHIC.js");
|
|
91
|
-
var _chunkYGNNHTFEjs = require("./chunk-YGNNHTFE.js");
|
|
92
|
-
var _chunkA7UBOIALjs = require("./chunk-A7UBOIAL.js");
|
|
93
|
-
// src/provider/index.tsx
|
|
94
|
-
var _react = require("react");
|
|
95
|
-
var _react2 = _interopRequireDefault(_react);
|
|
96
|
-
var _config = require("app/config");
|
|
97
|
-
var persist = _config.config.get("KEYCLOAK_PERSIST") === "1";
|
|
98
|
-
var AuthProvider = function(_param) {
|
|
99
|
-
var // keycloak config
|
|
100
|
-
realm = _param.realm, clientId = _param.clientId, baseUrl = _param.baseUrl, // auth config
|
|
101
|
-
debug = _param.debug, ensureFreshness = _param.ensureFreshness, loginRoute = _param.loginRoute, messageHandlerKeys = _param.messageHandlerKeys, ssr = _param.ssr, // props
|
|
102
|
-
children = _param.children, cookies = _param.cookies, disabled = _param.disabled, loadingComponent = _param.loadingComponent, onEvent = _param.onEvent, onTokens = _param.onTokens, keycloakInitOptions = _object_without_properties(_param, [
|
|
103
|
-
"realm",
|
|
104
|
-
"clientId",
|
|
105
|
-
"baseUrl",
|
|
106
|
-
"debug",
|
|
107
|
-
"ensureFreshness",
|
|
108
|
-
"loginRoute",
|
|
109
|
-
"messageHandlerKeys",
|
|
110
|
-
"ssr",
|
|
111
|
-
"children",
|
|
112
|
-
"cookies",
|
|
113
|
-
"disabled",
|
|
114
|
-
"loadingComponent",
|
|
115
|
-
"onEvent",
|
|
116
|
-
"onTokens"
|
|
117
|
-
]);
|
|
118
|
-
var tokensFromQuery = _chunkKLLABHICjs.useTokensFromQuery.call(void 0);
|
|
119
|
-
var tokensFromState = _chunkYGNNHTFEjs.useTokensFromState.call(void 0);
|
|
120
|
-
var authConfig = _react.useMemo.call(void 0, function() {
|
|
121
|
-
return _object_spread_props(_object_spread({}, _chunkA7UBOIALjs.defaultAuthConfig, typeof debug !== "undefined" ? {
|
|
122
|
-
debug: debug
|
|
123
|
-
} : {}, typeof ensureFreshness !== "undefined" ? {
|
|
124
|
-
ensureFreshness: ensureFreshness
|
|
125
|
-
} : {}, typeof loginRoute !== "undefined" ? {
|
|
126
|
-
loginRoute: loginRoute
|
|
127
|
-
} : {}, typeof messageHandlerKeys !== "undefined" ? {
|
|
128
|
-
messageHandlerKeys: messageHandlerKeys
|
|
129
|
-
} : {}), {
|
|
130
|
-
persist: !tokensFromState && !tokensFromQuery && cookies && ssr ? false : typeof persist !== "undefined" ? persist : _chunkA7UBOIALjs.defaultAuthConfig.persist,
|
|
131
|
-
ssr: !tokensFromState && !tokensFromQuery && cookies ? typeof ssr !== "undefined" ? ssr : _chunkA7UBOIALjs.defaultAuthConfig.ssr : false
|
|
132
|
-
});
|
|
133
|
-
}, [
|
|
134
|
-
debug,
|
|
135
|
-
ensureFreshness,
|
|
136
|
-
loginRoute,
|
|
137
|
-
messageHandlerKeys,
|
|
138
|
-
persist,
|
|
139
|
-
ssr
|
|
140
|
-
]);
|
|
141
|
-
if (disabled) {
|
|
142
|
-
return /* @__PURE__ */ _react2.default.createElement(_chunkA7UBOIALjs.AuthConfigContext.Provider, {
|
|
143
|
-
value: authConfig
|
|
144
|
-
}, children);
|
|
145
|
-
}
|
|
146
|
-
return /* @__PURE__ */ _react2.default.createElement(_chunkA7UBOIALjs.AuthConfigContext.Provider, {
|
|
147
|
-
value: authConfig
|
|
148
|
-
}, /* @__PURE__ */ _react2.default.createElement(_chunkK33RKJZXjs.KeycloakProvider, {
|
|
149
|
-
cookies: cookies,
|
|
150
|
-
keycloakConfig: {
|
|
151
|
-
realm: realm || "main",
|
|
152
|
-
clientId: clientId || "app",
|
|
153
|
-
url: baseUrl
|
|
154
|
-
},
|
|
155
|
-
keycloakInitOptions: keycloakInitOptions,
|
|
156
|
-
loadingComponent: loadingComponent,
|
|
157
|
-
onEvent: onEvent,
|
|
158
|
-
onTokens: onTokens
|
|
159
|
-
}, children));
|
|
160
|
-
};
|
|
161
|
-
exports.AuthProvider = AuthProvider;
|
package/lib/chunk-XEO3YXBM.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _type_of(obj) {
|
|
3
|
-
"@swc/helpers - typeof";
|
|
4
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
5
|
-
}
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __defNormalProp = function(obj, key, value) {
|
|
11
|
-
return key in obj ? __defProp(obj, key, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: value
|
|
16
|
-
}) : obj[key] = value;
|
|
17
|
-
};
|
|
18
|
-
var __publicField = function(obj, key, value) {
|
|
19
|
-
__defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value);
|
|
20
|
-
return value;
|
|
21
|
-
};
|
|
22
|
-
exports.__publicField = __publicField;
|
package/lib/chunk-XO4W2SMN.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useKeycloak
|
|
3
|
-
} from "./chunk-UHTKOFS6.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useAuthConfig
|
|
6
|
-
} from "./chunk-Y4XMF3R6.mjs";
|
|
7
|
-
import {
|
|
8
|
-
useAuthState
|
|
9
|
-
} from "./chunk-AD6VPMID.mjs";
|
|
10
|
-
|
|
11
|
-
// src/provider/afterAuth.tsx
|
|
12
|
-
import React, { useEffect } from "react";
|
|
13
|
-
var logger = console;
|
|
14
|
-
var AfterAuth = ({ children }) => {
|
|
15
|
-
const authConfig = useAuthConfig();
|
|
16
|
-
const authState = useAuthState();
|
|
17
|
-
const { token, refreshToken, authenticated, idToken } = useKeycloak();
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (!authenticated)
|
|
20
|
-
return;
|
|
21
|
-
if (authConfig.persist && token) {
|
|
22
|
-
authState.setToken(token);
|
|
23
|
-
if (idToken)
|
|
24
|
-
authState.setIdToken(idToken);
|
|
25
|
-
if (authConfig.ensureFreshness && refreshToken)
|
|
26
|
-
authState.setRefreshToken(refreshToken);
|
|
27
|
-
}
|
|
28
|
-
}, [token, refreshToken, idToken]);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (authConfig.debug && authState.token)
|
|
31
|
-
logger.debug("token", authState.token);
|
|
32
|
-
}, [authState.token]);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (authConfig.debug && authState.idToken)
|
|
35
|
-
logger.debug("idToken", authState.idToken);
|
|
36
|
-
}, [authState.idToken]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (authConfig.debug && authState.refreshToken)
|
|
39
|
-
logger.debug("refreshToken", authState.refreshToken);
|
|
40
|
-
}, [authState.refreshToken]);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (authConfig.debug)
|
|
43
|
-
logger.debug("authenticated", authenticated);
|
|
44
|
-
}, [authenticated]);
|
|
45
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
AfterAuth
|
|
50
|
-
};
|
package/lib/chunk-XVPWAAZ4.mjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
KeycloakProvider
|
|
3
|
-
} from "./chunk-BVB33X7V.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useTokensFromQuery
|
|
6
|
-
} from "./chunk-NXTVYIBR.mjs";
|
|
7
|
-
import {
|
|
8
|
-
useTokensFromState
|
|
9
|
-
} from "./chunk-UOKDJT5L.mjs";
|
|
10
|
-
import {
|
|
11
|
-
AuthConfigContext,
|
|
12
|
-
defaultAuthConfig
|
|
13
|
-
} from "./chunk-64PPU7Q3.mjs";
|
|
14
|
-
|
|
15
|
-
// src/provider/index.tsx
|
|
16
|
-
import React, { useMemo } from "react";
|
|
17
|
-
import { config } from "app/config";
|
|
18
|
-
var persist = config.get("KEYCLOAK_PERSIST") === "1";
|
|
19
|
-
var AuthProvider = ({
|
|
20
|
-
// keycloak config
|
|
21
|
-
realm,
|
|
22
|
-
clientId,
|
|
23
|
-
baseUrl,
|
|
24
|
-
// auth config
|
|
25
|
-
debug,
|
|
26
|
-
ensureFreshness,
|
|
27
|
-
loginRoute,
|
|
28
|
-
messageHandlerKeys,
|
|
29
|
-
ssr,
|
|
30
|
-
// props
|
|
31
|
-
children,
|
|
32
|
-
cookies,
|
|
33
|
-
disabled,
|
|
34
|
-
loadingComponent,
|
|
35
|
-
onEvent,
|
|
36
|
-
onTokens,
|
|
37
|
-
...keycloakInitOptions
|
|
38
|
-
}) => {
|
|
39
|
-
const tokensFromQuery = useTokensFromQuery();
|
|
40
|
-
const tokensFromState = useTokensFromState();
|
|
41
|
-
const authConfig = useMemo(
|
|
42
|
-
() => ({
|
|
43
|
-
...defaultAuthConfig,
|
|
44
|
-
...typeof debug !== "undefined" ? { debug } : {},
|
|
45
|
-
...typeof ensureFreshness !== "undefined" ? { ensureFreshness } : {},
|
|
46
|
-
...typeof loginRoute !== "undefined" ? { loginRoute } : {},
|
|
47
|
-
...typeof messageHandlerKeys !== "undefined" ? { messageHandlerKeys } : {},
|
|
48
|
-
persist: !tokensFromState && !tokensFromQuery && cookies && ssr ? false : typeof persist !== "undefined" ? persist : defaultAuthConfig.persist,
|
|
49
|
-
ssr: !tokensFromState && !tokensFromQuery && cookies ? typeof ssr !== "undefined" ? ssr : defaultAuthConfig.ssr : false
|
|
50
|
-
}),
|
|
51
|
-
[debug, ensureFreshness, loginRoute, messageHandlerKeys, persist, ssr]
|
|
52
|
-
);
|
|
53
|
-
if (disabled) {
|
|
54
|
-
return /* @__PURE__ */ React.createElement(AuthConfigContext.Provider, { value: authConfig }, children);
|
|
55
|
-
}
|
|
56
|
-
return /* @__PURE__ */ React.createElement(AuthConfigContext.Provider, { value: authConfig }, /* @__PURE__ */ React.createElement(
|
|
57
|
-
KeycloakProvider,
|
|
58
|
-
{
|
|
59
|
-
cookies,
|
|
60
|
-
keycloakConfig: {
|
|
61
|
-
realm: realm || "main",
|
|
62
|
-
clientId: clientId || "app",
|
|
63
|
-
url: baseUrl
|
|
64
|
-
},
|
|
65
|
-
keycloakInitOptions,
|
|
66
|
-
loadingComponent,
|
|
67
|
-
onEvent,
|
|
68
|
-
onTokens
|
|
69
|
-
},
|
|
70
|
-
children
|
|
71
|
-
));
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
AuthProvider
|
|
76
|
-
};
|
package/lib/chunk-YGNNHTFE.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var _chunkC2FNSVJOjs = require("./chunk-C2FNSVJO.js");
|
|
6
|
-
var _chunkNWRANDZ6js = require("./chunk-NWRANDZ6.js");
|
|
7
|
-
// src/hooks/useTokensFromState.ts
|
|
8
|
-
function useTokensFromState() {
|
|
9
|
-
var authState = _chunkC2FNSVJOjs.useAuthState.call(void 0);
|
|
10
|
-
return !!_chunkNWRANDZ6js.validToken.call(void 0, authState.token, authState.refreshToken);
|
|
11
|
-
}
|
|
12
|
-
exports.useTokensFromState = useTokensFromState;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
require("../../chunk-XEO3YXBM.js");
|
|
6
|
-
// src/hooks/useCurrentRouteName/index.native.ts
|
|
7
|
-
var _multiplatformone = require("multiplatform.one");
|
|
8
|
-
var _native = require("@react-navigation/native");
|
|
9
|
-
function useCurrentRouteName() {
|
|
10
|
-
if (_multiplatformone.MultiPlatform.isStorybook) return null;
|
|
11
|
-
var route = _native.useRoute.call(void 0);
|
|
12
|
-
return route.name;
|
|
13
|
-
}
|
|
14
|
-
exports.useCurrentRouteName = useCurrentRouteName;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import "../../chunk-RPUOO7AV.mjs";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useCurrentRouteName/index.native.ts
|
|
4
|
-
import { MultiPlatform } from "multiplatform.one";
|
|
5
|
-
import { useRoute } from "@react-navigation/native";
|
|
6
|
-
function useCurrentRouteName() {
|
|
7
|
-
if (MultiPlatform.isStorybook)
|
|
8
|
-
return null;
|
|
9
|
-
const route = useRoute();
|
|
10
|
-
return route.name;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
useCurrentRouteName
|
|
14
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as _bitspur_keycloak_js from '@bitspur/keycloak-js';
|
|
2
|
-
import { KeycloakRoles, KeycloakTokenParsed, KeycloakResourceAccess } from '@bitspur/keycloak-js';
|
|
3
|
-
|
|
4
|
-
declare function useKeycloak(): Keycloak;
|
|
5
|
-
declare class Keycloak implements IKeycloak {
|
|
6
|
-
private readonly keycloak;
|
|
7
|
-
authenticated?: boolean;
|
|
8
|
-
constructor(keycloak: IKeycloak | undefined, initialized: boolean);
|
|
9
|
-
get idToken(): string | undefined;
|
|
10
|
-
get realmAccess(): _bitspur_keycloak_js.KeycloakRoles | undefined;
|
|
11
|
-
get refreshToken(): string | undefined;
|
|
12
|
-
get refreshTokenParsed(): _bitspur_keycloak_js.KeycloakTokenParsed | undefined;
|
|
13
|
-
get resourceAccess(): _bitspur_keycloak_js.KeycloakResourceAccess | undefined;
|
|
14
|
-
get subject(): string | undefined;
|
|
15
|
-
get token(): string | undefined;
|
|
16
|
-
get tokenParsed(): ITokenParsed | undefined;
|
|
17
|
-
get email(): any;
|
|
18
|
-
get username(): string | undefined;
|
|
19
|
-
login(): Promise<unknown>;
|
|
20
|
-
logout(): Promise<unknown>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface IKeycloak {
|
|
24
|
-
authenticated?: boolean;
|
|
25
|
-
idToken?: string;
|
|
26
|
-
realmAccess?: KeycloakRoles;
|
|
27
|
-
refreshToken?: string;
|
|
28
|
-
refreshTokenParsed?: KeycloakTokenParsed;
|
|
29
|
-
resourceAccess?: KeycloakResourceAccess;
|
|
30
|
-
subject?: string;
|
|
31
|
-
token?: string;
|
|
32
|
-
tokenParsed?: ITokenParsed;
|
|
33
|
-
email?: string;
|
|
34
|
-
username?: string;
|
|
35
|
-
login: () => Promise<unknown>;
|
|
36
|
-
logout: () => Promise<unknown>;
|
|
37
|
-
}
|
|
38
|
-
interface ITokenParsed extends KeycloakTokenParsed {
|
|
39
|
-
'allowed-origins'?: string[];
|
|
40
|
-
email_verified?: boolean;
|
|
41
|
-
preferred_username?: string;
|
|
42
|
-
scope?: string;
|
|
43
|
-
sid?: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { type IKeycloak, type ITokenParsed, Keycloak, useKeycloak };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as _bitspur_keycloak_js from '@bitspur/keycloak-js';
|
|
2
|
-
import { KeycloakRoles, KeycloakTokenParsed, KeycloakResourceAccess } from '@bitspur/keycloak-js';
|
|
3
|
-
|
|
4
|
-
declare function useKeycloak(): Keycloak;
|
|
5
|
-
declare class Keycloak implements IKeycloak {
|
|
6
|
-
private readonly keycloak;
|
|
7
|
-
authenticated?: boolean;
|
|
8
|
-
constructor(keycloak: IKeycloak | undefined, initialized: boolean);
|
|
9
|
-
get idToken(): string | undefined;
|
|
10
|
-
get realmAccess(): _bitspur_keycloak_js.KeycloakRoles | undefined;
|
|
11
|
-
get refreshToken(): string | undefined;
|
|
12
|
-
get refreshTokenParsed(): _bitspur_keycloak_js.KeycloakTokenParsed | undefined;
|
|
13
|
-
get resourceAccess(): _bitspur_keycloak_js.KeycloakResourceAccess | undefined;
|
|
14
|
-
get subject(): string | undefined;
|
|
15
|
-
get token(): string | undefined;
|
|
16
|
-
get tokenParsed(): ITokenParsed | undefined;
|
|
17
|
-
get email(): any;
|
|
18
|
-
get username(): string | undefined;
|
|
19
|
-
login(): Promise<unknown>;
|
|
20
|
-
logout(): Promise<unknown>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface IKeycloak {
|
|
24
|
-
authenticated?: boolean;
|
|
25
|
-
idToken?: string;
|
|
26
|
-
realmAccess?: KeycloakRoles;
|
|
27
|
-
refreshToken?: string;
|
|
28
|
-
refreshTokenParsed?: KeycloakTokenParsed;
|
|
29
|
-
resourceAccess?: KeycloakResourceAccess;
|
|
30
|
-
subject?: string;
|
|
31
|
-
token?: string;
|
|
32
|
-
tokenParsed?: ITokenParsed;
|
|
33
|
-
email?: string;
|
|
34
|
-
username?: string;
|
|
35
|
-
login: () => Promise<unknown>;
|
|
36
|
-
logout: () => Promise<unknown>;
|
|
37
|
-
}
|
|
38
|
-
interface ITokenParsed extends KeycloakTokenParsed {
|
|
39
|
-
'allowed-origins'?: string[];
|
|
40
|
-
email_verified?: boolean;
|
|
41
|
-
preferred_username?: string;
|
|
42
|
-
scope?: string;
|
|
43
|
-
sid?: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { type IKeycloak, type ITokenParsed, Keycloak, useKeycloak };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
require("../../chunk-6NDWOV55.js");
|
|
6
|
-
var _chunkUL6L5ONIjs = require("../../chunk-UL6L5ONI.js");
|
|
7
|
-
require("../../chunk-3ZPHNEJL.js");
|
|
8
|
-
require("../../chunk-A7UBOIAL.js");
|
|
9
|
-
require("../../chunk-XEO3YXBM.js");
|
|
10
|
-
exports.Keycloak = _chunkUL6L5ONIjs.Keycloak;
|
|
11
|
-
exports.useKeycloak = _chunkUL6L5ONIjs.useKeycloak;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "../../chunk-2GUOEPFY.mjs";
|
|
2
|
-
import {
|
|
3
|
-
Keycloak,
|
|
4
|
-
useKeycloak
|
|
5
|
-
} from "../../chunk-UHTKOFS6.mjs";
|
|
6
|
-
import "../../chunk-Y4XMF3R6.mjs";
|
|
7
|
-
import "../../chunk-64PPU7Q3.mjs";
|
|
8
|
-
import "../../chunk-RPUOO7AV.mjs";
|
|
9
|
-
export {
|
|
10
|
-
Keycloak,
|
|
11
|
-
useKeycloak
|
|
12
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var _chunkUL6L5ONIjs = require("../../chunk-UL6L5ONI.js");
|
|
6
|
-
require("../../chunk-3ZPHNEJL.js");
|
|
7
|
-
require("../../chunk-A7UBOIAL.js");
|
|
8
|
-
require("../../chunk-XEO3YXBM.js");
|
|
9
|
-
exports.Keycloak = _chunkUL6L5ONIjs.Keycloak;
|
|
10
|
-
exports.useKeycloak = _chunkUL6L5ONIjs.useKeycloak;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';
|
|
2
|
-
import { IKeycloak } from './index.mjs';
|
|
3
|
-
import { KeycloakTokenParsed, KeycloakRoles, KeycloakResourceAccess } from '@bitspur/keycloak-js';
|
|
4
|
-
|
|
5
|
-
declare function useKeycloak(): IKeycloak;
|
|
6
|
-
declare class ExpoKeycloak implements IKeycloak {
|
|
7
|
-
logout: () => Promise<unknown>;
|
|
8
|
-
token?: string | undefined;
|
|
9
|
-
refreshToken?: string | undefined;
|
|
10
|
-
authenticated?: boolean;
|
|
11
|
-
tokenParsed?: KeycloakTokenParsed;
|
|
12
|
-
refreshTokenParsed?: KeycloakTokenParsed;
|
|
13
|
-
subject?: string;
|
|
14
|
-
realmAccess?: KeycloakRoles;
|
|
15
|
-
resourceAccess?: KeycloakResourceAccess;
|
|
16
|
-
login: () => Promise<unknown>;
|
|
17
|
-
constructor(ready: boolean, isLoggedIn: boolean | undefined, login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>, logout: () => Promise<unknown>, token?: string | undefined, refreshToken?: string | undefined);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { ExpoKeycloak, useKeycloak };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';
|
|
2
|
-
import { IKeycloak } from './index.js';
|
|
3
|
-
import { KeycloakTokenParsed, KeycloakRoles, KeycloakResourceAccess } from '@bitspur/keycloak-js';
|
|
4
|
-
|
|
5
|
-
declare function useKeycloak(): IKeycloak;
|
|
6
|
-
declare class ExpoKeycloak implements IKeycloak {
|
|
7
|
-
logout: () => Promise<unknown>;
|
|
8
|
-
token?: string | undefined;
|
|
9
|
-
refreshToken?: string | undefined;
|
|
10
|
-
authenticated?: boolean;
|
|
11
|
-
tokenParsed?: KeycloakTokenParsed;
|
|
12
|
-
refreshTokenParsed?: KeycloakTokenParsed;
|
|
13
|
-
subject?: string;
|
|
14
|
-
realmAccess?: KeycloakRoles;
|
|
15
|
-
resourceAccess?: KeycloakResourceAccess;
|
|
16
|
-
login: () => Promise<unknown>;
|
|
17
|
-
constructor(ready: boolean, isLoggedIn: boolean | undefined, login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>, logout: () => Promise<unknown>, token?: string | undefined, refreshToken?: string | undefined);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { ExpoKeycloak, useKeycloak };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function _class_call_check(instance, Constructor) {
|
|
3
|
-
if (!(instance instanceof Constructor)) {
|
|
4
|
-
throw new TypeError("Cannot call a class as a function");
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
function _interopRequireDefault(obj) {
|
|
11
|
-
return obj && obj.__esModule ? obj : {
|
|
12
|
-
default: obj
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
var _chunkXEO3YXBMjs = require("../../chunk-XEO3YXBM.js");
|
|
16
|
-
// src/hooks/useKeycloak/useKeycloak.native.ts
|
|
17
|
-
var _atob = require("core-js-pure/stable/atob");
|
|
18
|
-
var _atob2 = _interopRequireDefault(_atob);
|
|
19
|
-
var _escape = require("core-js-pure/stable/escape");
|
|
20
|
-
var _escape2 = _interopRequireDefault(_escape);
|
|
21
|
-
var _multiplatformone = require("multiplatform.one");
|
|
22
|
-
var _expokeycloakauth = require("expo-keycloak-auth");
|
|
23
|
-
function useKeycloak() {
|
|
24
|
-
if (_multiplatformone.MultiPlatform.isStorybook) return {
|
|
25
|
-
authenticated: true
|
|
26
|
-
};
|
|
27
|
-
var _expokeycloakauth_useKeycloak_call = _expokeycloakauth.useKeycloak.call(void 0), ready = _expokeycloakauth_useKeycloak_call.ready, login = _expokeycloakauth_useKeycloak_call.login, isLoggedIn = _expokeycloakauth_useKeycloak_call.isLoggedIn, token = _expokeycloakauth_useKeycloak_call.token, logout = _expokeycloakauth_useKeycloak_call.logout, refreshToken = _expokeycloakauth_useKeycloak_call.refreshToken;
|
|
28
|
-
var keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || void 0, refreshToken || void 0);
|
|
29
|
-
return keycloak;
|
|
30
|
-
}
|
|
31
|
-
var ExpoKeycloak = function ExpoKeycloak(ready, isLoggedIn, login, logout, token, refreshToken) {
|
|
32
|
-
_class_call_check(this, ExpoKeycloak);
|
|
33
|
-
this.logout = logout;
|
|
34
|
-
this.token = token;
|
|
35
|
-
this.refreshToken = refreshToken;
|
|
36
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "authenticated");
|
|
37
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "tokenParsed");
|
|
38
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "refreshTokenParsed");
|
|
39
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "subject");
|
|
40
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "realmAccess");
|
|
41
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "resourceAccess");
|
|
42
|
-
_chunkXEO3YXBMjs.__publicField.call(void 0, this, "login");
|
|
43
|
-
if (ready) this.authenticated = isLoggedIn;
|
|
44
|
-
if (this.authenticated) {
|
|
45
|
-
if (this.token) this.tokenParsed = decodeToken(this.token);
|
|
46
|
-
if (this.refreshToken) {
|
|
47
|
-
this.refreshTokenParsed = decodeToken(this.refreshToken);
|
|
48
|
-
}
|
|
49
|
-
if (this.tokenParsed) {
|
|
50
|
-
this.subject = this.tokenParsed.sub;
|
|
51
|
-
this.realmAccess = this.tokenParsed.realm_access;
|
|
52
|
-
this.resourceAccess = this.tokenParsed.resource_access;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
this.login = function() {
|
|
56
|
-
return login();
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
function decodeToken(str) {
|
|
60
|
-
str = str.split(".")[1];
|
|
61
|
-
str = str.replace(/-/g, "+");
|
|
62
|
-
str = str.replace(/_/g, "/");
|
|
63
|
-
switch(str.length % 4){
|
|
64
|
-
case 0:
|
|
65
|
-
break;
|
|
66
|
-
case 2:
|
|
67
|
-
str += "==";
|
|
68
|
-
break;
|
|
69
|
-
case 3:
|
|
70
|
-
str += "=";
|
|
71
|
-
break;
|
|
72
|
-
default:
|
|
73
|
-
throw "Invalid token";
|
|
74
|
-
}
|
|
75
|
-
str = decodeURIComponent(_escape2.default.call(void 0, _atob2.default.call(void 0, str)));
|
|
76
|
-
str = JSON.parse(str);
|
|
77
|
-
return str;
|
|
78
|
-
}
|
|
79
|
-
exports.ExpoKeycloak = ExpoKeycloak;
|
|
80
|
-
exports.useKeycloak = useKeycloak;
|