antaeus.keycloak.react 2.1.3 → 2.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/README.md +210 -2
- package/dist/index.d.mts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useAuth as useAuth$1, AuthProvider } from 'react-oidc-context';
|
|
3
|
+
import { WebStorageStateStore, User } from 'oidc-client-ts';
|
|
3
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
import { useLocation } from 'react-router-dom';
|
|
5
6
|
import { QRCodeSVG } from 'qrcode.react';
|
|
6
|
-
import { User } from 'oidc-client-ts';
|
|
7
7
|
|
|
8
8
|
// src/components/KeycloakProvider.tsx
|
|
9
9
|
|
|
@@ -33,7 +33,8 @@ var defaultConfig = {
|
|
|
33
33
|
responseType: "code",
|
|
34
34
|
codeChallengeMethod: "S256",
|
|
35
35
|
loadUserInfo: true,
|
|
36
|
-
automaticSilentSignIn: false
|
|
36
|
+
automaticSilentSignIn: false,
|
|
37
|
+
storageType: "session"
|
|
37
38
|
},
|
|
38
39
|
events: {}
|
|
39
40
|
};
|
|
@@ -50,6 +51,8 @@ var KeycloakConfigBuilder = class {
|
|
|
50
51
|
static build(userConfig) {
|
|
51
52
|
this.validate(userConfig);
|
|
52
53
|
const config = this.mergeWithDefaults(userConfig);
|
|
54
|
+
const storageType = config.advanced.storageType || "session";
|
|
55
|
+
const storage = storageType === "local" ? window.localStorage : window.sessionStorage;
|
|
53
56
|
const oidcSettings = {
|
|
54
57
|
authority: config.authority,
|
|
55
58
|
client_id: config.clientId,
|
|
@@ -60,6 +63,8 @@ var KeycloakConfigBuilder = class {
|
|
|
60
63
|
automaticSilentRenew: config.silentRenew.enabled,
|
|
61
64
|
loadUserInfo: config.advanced.loadUserInfo,
|
|
62
65
|
silent_redirect_uri: config.silentRenew.silentRedirectUri,
|
|
66
|
+
// Configure storage for user data and tokens
|
|
67
|
+
userStore: new WebStorageStateStore({ store: storage }),
|
|
63
68
|
// Add PKCE support (required for public clients)
|
|
64
69
|
...config.advanced.codeChallengeMethod && {
|
|
65
70
|
response_mode: "query"
|