antaeus.keycloak.react 2.6.4 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/index.d.mts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1992,6 +1992,59 @@ function useProtectedFetch(options = {}) {
|
|
|
1992
1992
|
};
|
|
1993
1993
|
}
|
|
1994
1994
|
|
|
1995
|
+
// src/utils/storedOidcSession.ts
|
|
1996
|
+
var getOidcUserStorageKey = (authority, clientId) => {
|
|
1997
|
+
if (!authority || !clientId) {
|
|
1998
|
+
return null;
|
|
1999
|
+
}
|
|
2000
|
+
return `oidc.user:${authority}:${clientId}`;
|
|
2001
|
+
};
|
|
2002
|
+
var getStoredOidcUser = ({
|
|
2003
|
+
authority,
|
|
2004
|
+
clientId,
|
|
2005
|
+
storage
|
|
2006
|
+
}) => {
|
|
2007
|
+
const storageKey = getOidcUserStorageKey(authority, clientId);
|
|
2008
|
+
if (!storageKey || !storage) {
|
|
2009
|
+
return null;
|
|
2010
|
+
}
|
|
2011
|
+
try {
|
|
2012
|
+
const storedUser = storage.getItem(storageKey);
|
|
2013
|
+
if (!storedUser) {
|
|
2014
|
+
return null;
|
|
2015
|
+
}
|
|
2016
|
+
return JSON.parse(storedUser);
|
|
2017
|
+
} catch {
|
|
2018
|
+
return null;
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
var hasStoredOidcRefreshToken = (args) => {
|
|
2022
|
+
const storedUser = getStoredOidcUser(args);
|
|
2023
|
+
return typeof storedUser?.refresh_token === "string" && storedUser.refresh_token.length > 0;
|
|
2024
|
+
};
|
|
2025
|
+
var getStoredOidcSession = (args) => {
|
|
2026
|
+
const storageKey = getOidcUserStorageKey(args.authority, args.clientId);
|
|
2027
|
+
const storedUser = getStoredOidcUser(args);
|
|
2028
|
+
return {
|
|
2029
|
+
storageKey,
|
|
2030
|
+
storedUser,
|
|
2031
|
+
hasStoredUser: storedUser !== null,
|
|
2032
|
+
hasRefreshToken: typeof storedUser?.refresh_token === "string" && storedUser.refresh_token.length > 0
|
|
2033
|
+
};
|
|
2034
|
+
};
|
|
2035
|
+
|
|
2036
|
+
// src/hooks/useStoredOidcSession.ts
|
|
2037
|
+
var useStoredOidcSession = () => {
|
|
2038
|
+
const auth = useAuth();
|
|
2039
|
+
const { storage } = useStorageConfig();
|
|
2040
|
+
const authority = auth.settings.authority;
|
|
2041
|
+
const clientId = auth.settings.client_id;
|
|
2042
|
+
return useMemo(
|
|
2043
|
+
() => getStoredOidcSession({ authority, clientId, storage }),
|
|
2044
|
+
[authority, clientId, storage]
|
|
2045
|
+
);
|
|
2046
|
+
};
|
|
2047
|
+
|
|
1995
2048
|
// node_modules/@microsoft/signalr/dist/esm/Errors.js
|
|
1996
2049
|
var HttpError = class extends Error {
|
|
1997
2050
|
/** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
|
|
@@ -5030,6 +5083,6 @@ function useSignalRConnection(hubUrl, options = {}) {
|
|
|
5030
5083
|
};
|
|
5031
5084
|
}
|
|
5032
5085
|
|
|
5033
|
-
export { CONFIG_PRESETS, DeviceLogin, KeycloakConfigBuilder, KeycloakProvider, KeycloakStatusProvider, LoginButton, LogoutButton, ProtectedRoute, SessionMonitor, TokenBridge, TokenBridgeSync, TokenLifecycleManager, UserProfile, createTokenBridge, defaultConfig, defaultTokenBridge, fetchUserInfo, getConfigFromEnv, getConfigPreset, mergeWithPreset, pollForToken, requestDeviceCode, useAuth, useKeycloakStatus, useProtectedFetch, useRoles, useScopes, useSignalRConnection, useTokenLifecycle };
|
|
5086
|
+
export { CONFIG_PRESETS, DeviceLogin, KeycloakConfigBuilder, KeycloakProvider, KeycloakStatusProvider, LoginButton, LogoutButton, ProtectedRoute, SessionMonitor, TokenBridge, TokenBridgeSync, TokenLifecycleManager, UserProfile, createTokenBridge, defaultConfig, defaultTokenBridge, fetchUserInfo, getConfigFromEnv, getConfigPreset, getOidcUserStorageKey, getStoredOidcSession, getStoredOidcUser, hasStoredOidcRefreshToken, mergeWithPreset, pollForToken, requestDeviceCode, useAuth, useKeycloakStatus, useProtectedFetch, useRoles, useScopes, useSignalRConnection, useStoredOidcSession, useTokenLifecycle };
|
|
5034
5087
|
//# sourceMappingURL=index.mjs.map
|
|
5035
5088
|
//# sourceMappingURL=index.mjs.map
|