@react-keycloak-refork/web 6.0.0 → 8.0.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/LICENSE.md +24 -24
- package/README.md +7 -7
- package/lib/context.d.ts +3 -3
- package/lib/context.js +3 -3
- package/lib/context.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -3
- package/lib/provider.d.ts +140 -146
- package/lib/provider.js +3 -3
- package/lib/provider.js.map +1 -1
- package/lib/useKeycloak.d.ts +4 -4
- package/lib/useKeycloak.js +16 -16
- package/lib/useKeycloak.js.map +1 -1
- package/lib/withKeycloak.d.ts +43 -43
- package/lib/withKeycloak.js +24 -24
- package/lib/withKeycloak.js.map +1 -1
- package/lib-commonjs/context.d.ts +3 -3
- package/lib-commonjs/context.js +6 -6
- package/lib-commonjs/context.js.map +1 -1
- package/lib-commonjs/index.d.ts +3 -3
- package/lib-commonjs/index.js +19 -19
- package/lib-commonjs/provider.d.ts +140 -146
- package/lib-commonjs/provider.js +6 -6
- package/lib-commonjs/provider.js.map +1 -1
- package/lib-commonjs/useKeycloak.d.ts +4 -4
- package/lib-commonjs/useKeycloak.js +19 -20
- package/lib-commonjs/useKeycloak.js.map +1 -1
- package/lib-commonjs/withKeycloak.d.ts +43 -43
- package/lib-commonjs/withKeycloak.js +27 -51
- package/lib-commonjs/withKeycloak.js.map +1 -1
- package/package.json +14 -10
package/LICENSE.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019-present, Mattia Panzeri <mattia.panzeri93@gmail.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person
|
|
6
|
-
obtaining a copy of this software and associated documentation
|
|
7
|
-
files (the "Software"), to deal in the Software without
|
|
8
|
-
restriction, including without limitation the rights to use,
|
|
9
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the
|
|
11
|
-
Software is furnished to do so, subject to the following
|
|
12
|
-
conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be
|
|
15
|
-
included in all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-present, Mattia Panzeri <mattia.panzeri93@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person
|
|
6
|
+
obtaining a copy of this software and associated documentation
|
|
7
|
+
files (the "Software"), to deal in the Software without
|
|
8
|
+
restriction, including without limitation the rights to use,
|
|
9
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the
|
|
11
|
+
Software is furnished to do so, subject to the following
|
|
12
|
+
conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be
|
|
15
|
+
included in all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> React bindings for [Keycloak](https://www.keycloak.org/). Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for keycloak >=17 support.
|
|
6
6
|
|
|
7
|
-
[](https://img.shields.io/npm/v/@react-keycloak-fork/web?label=npm%20%7C%20web)](https://www.npmjs.com/package/@react-keycloak-fork/web)
|
|
8
8
|
|
|
9
9
|
[](https://github.com/react-keycloak/react-keycloak/blob/master/LICENSE.md)
|
|
10
10
|
[](https://lerna.js.org/)
|
|
@@ -39,13 +39,13 @@ React Keycloak requires:
|
|
|
39
39
|
- `keycloak-js` **17.0.0** or later
|
|
40
40
|
|
|
41
41
|
```shell
|
|
42
|
-
yarn add @react-keycloak-
|
|
42
|
+
yarn add @react-keycloak-fork/web
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
or
|
|
46
46
|
|
|
47
47
|
```shell
|
|
48
|
-
npm install --save @react-keycloak-
|
|
48
|
+
npm install --save @react-keycloak-fork/web
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Getting Started
|
|
@@ -69,7 +69,7 @@ export default keycloak
|
|
|
69
69
|
Wrap your App inside `ReactKeycloakProvider` and pass the `keycloak` instance as prop
|
|
70
70
|
|
|
71
71
|
```js
|
|
72
|
-
import { ReactKeycloakProvider } from '@react-keycloak-
|
|
72
|
+
import { ReactKeycloakProvider } from '@react-keycloak-fork/web'
|
|
73
73
|
|
|
74
74
|
import keycloak from './keycloak'
|
|
75
75
|
|
|
@@ -141,7 +141,7 @@ const App = () => {
|
|
|
141
141
|
When a component requires access to `Keycloak`, you can use the `useKeycloak` Hook.
|
|
142
142
|
|
|
143
143
|
```js
|
|
144
|
-
import { useKeycloak } from '@react-keycloak-
|
|
144
|
+
import { useKeycloak } from '@react-keycloak-fork/web'
|
|
145
145
|
|
|
146
146
|
export default () => {
|
|
147
147
|
// Using Object destructuring
|
|
@@ -174,11 +174,11 @@ The instance will be initialized by `react-keycloak` but you'll need to be caref
|
|
|
174
174
|
|
|
175
175
|
## Examples
|
|
176
176
|
|
|
177
|
-
See inside `examples` folder of [`@react-keycloak-
|
|
177
|
+
See inside `examples` folder of [`@react-keycloak-fork/react-keycloak-examples`](https://github.com/react-keycloak/react-keycloak-examples) repository for various demo implementing this library main features.
|
|
178
178
|
|
|
179
179
|
## Guides and Articles
|
|
180
180
|
|
|
181
|
-
- Migration guide for `@react-keycloak-
|
|
181
|
+
- Migration guide for `@react-keycloak-fork/web` `v2.x to v3.x` can be found here [MIGRATION.md](https://github.com/react-keycloak/react-keycloak/blob/master/packages/web/MIGRATION.md).
|
|
182
182
|
|
|
183
183
|
- [Secure React Routes & Component with Keycloak](https://medium.com/@cagline/authenticate-and-authorize-react-routes-component-with-keycloak-666e85662636), a (slightly outdated) guide on how to setup `Keycloak` and create secured contents in a `React` app, thanks to [@cagline](https://github.com/cagline) for the detailed article.
|
|
184
184
|
|
package/lib/context.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const reactKeycloakWebContext: import("react").Context<import("@react-keycloak-
|
|
3
|
-
export declare const ReactKeycloakWebContextConsumer: import("react").Consumer<import("@react-keycloak-
|
|
1
|
+
import Keycloak from 'keycloak-js';
|
|
2
|
+
export declare const reactKeycloakWebContext: import("react").Context<import("@react-keycloak-fork/core").IAuthContextProps<Keycloak>>;
|
|
3
|
+
export declare const ReactKeycloakWebContextConsumer: import("react").Consumer<import("@react-keycloak-fork/core").IAuthContextProps<Keycloak>>;
|
package/lib/context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAuthContext } from '@react-keycloak-
|
|
2
|
-
export var reactKeycloakWebContext = createAuthContext();
|
|
3
|
-
export var ReactKeycloakWebContextConsumer = reactKeycloakWebContext.Consumer;
|
|
1
|
+
import { createAuthContext } from '@react-keycloak-fork/core';
|
|
2
|
+
export var reactKeycloakWebContext = createAuthContext();
|
|
3
|
+
export var ReactKeycloakWebContextConsumer = reactKeycloakWebContext.Consumer;
|
|
4
4
|
//# sourceMappingURL=context.js.map
|
package/lib/context.js.map
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"@react-keycloak-refork\\web\\context.ts"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": "AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
9
|
+
"mappings": "AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG7D,MAAM,CAAC,IAAM,uBAAuB,GAAG,iBAAiB,EAAY,CAAA;AAEpE,MAAM,CAAC,IAAM,+BAA+B,GAAG,uBAAuB,CAAC,QAAQ,CAAA"
|
|
10
10
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './provider';
|
|
2
|
-
export * from './useKeycloak';
|
|
3
|
-
export * from './withKeycloak';
|
|
1
|
+
export * from './provider';
|
|
2
|
+
export * from './useKeycloak';
|
|
3
|
+
export * from './withKeycloak';
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './provider';
|
|
2
|
-
export * from './useKeycloak';
|
|
3
|
-
export * from './withKeycloak';
|
|
1
|
+
export * from './provider';
|
|
2
|
+
export * from './useKeycloak';
|
|
3
|
+
export * from './withKeycloak';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/lib/provider.d.ts
CHANGED
|
@@ -1,146 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
initialized: boolean;
|
|
90
|
-
isAuthenticated: boolean;
|
|
91
|
-
isLoading: boolean;
|
|
92
|
-
}
|
|
93
|
-
initialized: boolean;
|
|
94
|
-
isAuthenticated: boolean;
|
|
95
|
-
isLoading: boolean;
|
|
96
|
-
}
|
|
97
|
-
initialized: boolean;
|
|
98
|
-
isAuthenticated: boolean;
|
|
99
|
-
isLoading: boolean;
|
|
100
|
-
}
|
|
101
|
-
initialized: boolean;
|
|
102
|
-
isAuthenticated: boolean;
|
|
103
|
-
isLoading: boolean;
|
|
104
|
-
} | Pick<{
|
|
105
|
-
initialized: boolean;
|
|
106
|
-
isAuthenticated: boolean;
|
|
107
|
-
isLoading: boolean;
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
initialized: boolean;
|
|
120
|
-
isAuthenticated: boolean;
|
|
121
|
-
isLoading: boolean;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
isAuthenticated: boolean;
|
|
142
|
-
isLoading: boolean;
|
|
143
|
-
}>, nextContext: any): void;
|
|
144
|
-
};
|
|
145
|
-
contextType?: import("react").Context<any> | undefined;
|
|
146
|
-
};
|
|
1
|
+
export declare const ReactKeycloakProvider: {
|
|
2
|
+
new (props: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>): {
|
|
3
|
+
state: {
|
|
4
|
+
initialized: boolean;
|
|
5
|
+
isAuthenticated: boolean;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
};
|
|
8
|
+
componentDidMount(): void;
|
|
9
|
+
componentDidUpdate({ authClient: prevAuthClient, initOptions: prevInitOptions, }: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>): void;
|
|
10
|
+
init(): void;
|
|
11
|
+
onError: (event: import("@react-keycloak-fork/core").AuthClientEvent) => (error?: import("@react-keycloak-fork/core").AuthClientError) => void;
|
|
12
|
+
updateState: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
|
|
13
|
+
refreshToken: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
|
|
14
|
+
render(): React.JSX.Element;
|
|
15
|
+
context: unknown;
|
|
16
|
+
setState<K extends keyof {
|
|
17
|
+
initialized: boolean;
|
|
18
|
+
isAuthenticated: boolean;
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
}>(state: {
|
|
21
|
+
initialized: boolean;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
} | ((prevState: Readonly<{
|
|
25
|
+
initialized: boolean;
|
|
26
|
+
isAuthenticated: boolean;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
}>, props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>) => {
|
|
29
|
+
initialized: boolean;
|
|
30
|
+
isAuthenticated: boolean;
|
|
31
|
+
isLoading: boolean;
|
|
32
|
+
} | Pick<{
|
|
33
|
+
initialized: boolean;
|
|
34
|
+
isAuthenticated: boolean;
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
}, K> | null) | Pick<{
|
|
37
|
+
initialized: boolean;
|
|
38
|
+
isAuthenticated: boolean;
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
}, K> | null, callback?: (() => void) | undefined): void;
|
|
41
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
42
|
+
readonly props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>;
|
|
43
|
+
shouldComponentUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
|
|
44
|
+
initialized: boolean;
|
|
45
|
+
isAuthenticated: boolean;
|
|
46
|
+
isLoading: boolean;
|
|
47
|
+
}>, nextContext: any): boolean;
|
|
48
|
+
componentWillUnmount?(): void;
|
|
49
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
50
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, prevState: Readonly<{
|
|
51
|
+
initialized: boolean;
|
|
52
|
+
isAuthenticated: boolean;
|
|
53
|
+
isLoading: boolean;
|
|
54
|
+
}>): any;
|
|
55
|
+
componentWillMount?(): void;
|
|
56
|
+
UNSAFE_componentWillMount?(): void;
|
|
57
|
+
componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
|
|
58
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
|
|
59
|
+
componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
|
|
60
|
+
initialized: boolean;
|
|
61
|
+
isAuthenticated: boolean;
|
|
62
|
+
isLoading: boolean;
|
|
63
|
+
}>, nextContext: any): void;
|
|
64
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
|
|
65
|
+
initialized: boolean;
|
|
66
|
+
isAuthenticated: boolean;
|
|
67
|
+
isLoading: boolean;
|
|
68
|
+
}>, nextContext: any): void;
|
|
69
|
+
};
|
|
70
|
+
new (props: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>, context: any): {
|
|
71
|
+
state: {
|
|
72
|
+
initialized: boolean;
|
|
73
|
+
isAuthenticated: boolean;
|
|
74
|
+
isLoading: boolean;
|
|
75
|
+
};
|
|
76
|
+
componentDidMount(): void;
|
|
77
|
+
componentDidUpdate({ authClient: prevAuthClient, initOptions: prevInitOptions, }: import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>): void;
|
|
78
|
+
init(): void;
|
|
79
|
+
onError: (event: import("@react-keycloak-fork/core").AuthClientEvent) => (error?: import("@react-keycloak-fork/core").AuthClientError) => void;
|
|
80
|
+
updateState: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
|
|
81
|
+
refreshToken: (event: import("@react-keycloak-fork/core").AuthClientEvent) => () => void;
|
|
82
|
+
render(): React.JSX.Element;
|
|
83
|
+
context: unknown;
|
|
84
|
+
setState<K extends keyof {
|
|
85
|
+
initialized: boolean;
|
|
86
|
+
isAuthenticated: boolean;
|
|
87
|
+
isLoading: boolean;
|
|
88
|
+
}>(state: {
|
|
89
|
+
initialized: boolean;
|
|
90
|
+
isAuthenticated: boolean;
|
|
91
|
+
isLoading: boolean;
|
|
92
|
+
} | ((prevState: Readonly<{
|
|
93
|
+
initialized: boolean;
|
|
94
|
+
isAuthenticated: boolean;
|
|
95
|
+
isLoading: boolean;
|
|
96
|
+
}>, props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>) => {
|
|
97
|
+
initialized: boolean;
|
|
98
|
+
isAuthenticated: boolean;
|
|
99
|
+
isLoading: boolean;
|
|
100
|
+
} | Pick<{
|
|
101
|
+
initialized: boolean;
|
|
102
|
+
isAuthenticated: boolean;
|
|
103
|
+
isLoading: boolean;
|
|
104
|
+
}, K> | null) | Pick<{
|
|
105
|
+
initialized: boolean;
|
|
106
|
+
isAuthenticated: boolean;
|
|
107
|
+
isLoading: boolean;
|
|
108
|
+
}, K> | null, callback?: (() => void) | undefined): void;
|
|
109
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
110
|
+
readonly props: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>;
|
|
111
|
+
shouldComponentUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
|
|
112
|
+
initialized: boolean;
|
|
113
|
+
isAuthenticated: boolean;
|
|
114
|
+
isLoading: boolean;
|
|
115
|
+
}>, nextContext: any): boolean;
|
|
116
|
+
componentWillUnmount?(): void;
|
|
117
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
118
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, prevState: Readonly<{
|
|
119
|
+
initialized: boolean;
|
|
120
|
+
isAuthenticated: boolean;
|
|
121
|
+
isLoading: boolean;
|
|
122
|
+
}>): any;
|
|
123
|
+
componentWillMount?(): void;
|
|
124
|
+
UNSAFE_componentWillMount?(): void;
|
|
125
|
+
componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
|
|
126
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextContext: any): void;
|
|
127
|
+
componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
|
|
128
|
+
initialized: boolean;
|
|
129
|
+
isAuthenticated: boolean;
|
|
130
|
+
isLoading: boolean;
|
|
131
|
+
}>, nextContext: any): void;
|
|
132
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("@react-keycloak-fork/core").AuthProviderProps<import("keycloak-js").default>>, nextState: Readonly<{
|
|
133
|
+
initialized: boolean;
|
|
134
|
+
isAuthenticated: boolean;
|
|
135
|
+
isLoading: boolean;
|
|
136
|
+
}>, nextContext: any): void;
|
|
137
|
+
};
|
|
138
|
+
contextType?: React.Context<any> | undefined;
|
|
139
|
+
propTypes?: any;
|
|
140
|
+
};
|
package/lib/provider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAuthProvider } from '@react-keycloak-
|
|
2
|
-
import { reactKeycloakWebContext } from './context';
|
|
3
|
-
export var ReactKeycloakProvider = createAuthProvider(reactKeycloakWebContext);
|
|
1
|
+
import { createAuthProvider } from '@react-keycloak-fork/core';
|
|
2
|
+
import { reactKeycloakWebContext } from './context';
|
|
3
|
+
export var ReactKeycloakProvider = createAuthProvider(reactKeycloakWebContext);
|
|
4
4
|
//# sourceMappingURL=provider.js.map
|
package/lib/provider.js.map
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"@react-keycloak-refork\\web\\provider.ts"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": "AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
9
|
+
"mappings": "AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,CAAC,IAAM,qBAAqB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAAA"
|
|
10
10
|
}
|
package/lib/useKeycloak.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function useKeycloak(): {
|
|
2
|
-
initialized: boolean;
|
|
3
|
-
keycloak: import("keycloak-js
|
|
4
|
-
};
|
|
1
|
+
export declare function useKeycloak(): {
|
|
2
|
+
initialized: boolean;
|
|
3
|
+
keycloak: import("keycloak-js").default;
|
|
4
|
+
};
|
package/lib/useKeycloak.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { reactKeycloakWebContext } from './context';
|
|
3
|
-
export function useKeycloak() {
|
|
4
|
-
var ctx = useContext(reactKeycloakWebContext);
|
|
5
|
-
if (!ctx) {
|
|
6
|
-
throw new Error('useKeycloak hook must be used inside ReactKeycloakProvider context');
|
|
7
|
-
}
|
|
8
|
-
if (!ctx.authClient) {
|
|
9
|
-
throw new Error('authClient has not been assigned to ReactKeycloakProvider');
|
|
10
|
-
}
|
|
11
|
-
var authClient = ctx.authClient, initialized = ctx.initialized;
|
|
12
|
-
return {
|
|
13
|
-
initialized: initialized,
|
|
14
|
-
keycloak: authClient,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { reactKeycloakWebContext } from './context';
|
|
3
|
+
export function useKeycloak() {
|
|
4
|
+
var ctx = useContext(reactKeycloakWebContext);
|
|
5
|
+
if (!ctx) {
|
|
6
|
+
throw new Error('useKeycloak hook must be used inside ReactKeycloakProvider context');
|
|
7
|
+
}
|
|
8
|
+
if (!ctx.authClient) {
|
|
9
|
+
throw new Error('authClient has not been assigned to ReactKeycloakProvider');
|
|
10
|
+
}
|
|
11
|
+
var authClient = ctx.authClient, initialized = ctx.initialized;
|
|
12
|
+
return {
|
|
13
|
+
initialized: initialized,
|
|
14
|
+
keycloak: authClient,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=useKeycloak.js.map
|
package/lib/useKeycloak.js.map
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"@react-keycloak-refork\\web\\useKeycloak.ts"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": "AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,UAAU,WAAW;IACzB,IAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAE/C,IAAI,CAAC,GAAG,EAAE;
|
|
9
|
+
"mappings": "AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAEnD,MAAM,UAAU,WAAW;IACzB,IAAM,GAAG,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAE/C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAA;IACH,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;IAC9E,CAAC;IAEO,IAAA,UAAU,GAAkB,GAAG,WAArB,EAAE,WAAW,GAAK,GAAG,YAAR,CAAQ;IACvC,OAAO;QACL,WAAW,aAAA;QACX,QAAQ,EAAE,UAAU;KACrB,CAAA;AACH,CAAC"
|
|
10
10
|
}
|
package/lib/withKeycloak.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type { KeycloakInstance } from 'keycloak-js';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
type InjectedProps = {
|
|
4
|
-
keycloakInitialized: boolean;
|
|
5
|
-
keycloak: KeycloakInstance;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* An HOC which injects the `keycloak` instance and the `keycloakInitialized` flag as props.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated Please migrate to useKeycloak hook where/when possible.
|
|
11
|
-
*/
|
|
12
|
-
export declare function withKeycloak<P extends InjectedProps>(Component: React.ComponentType<P>): React.FC<Subtract<P, InjectedProps>>;
|
|
13
|
-
/**
|
|
14
|
-
* SetDifference (same as Exclude)
|
|
15
|
-
* @desc Set difference of given union types `A` and `B`
|
|
16
|
-
* @example
|
|
17
|
-
* // Expect: "1"
|
|
18
|
-
* SetDifference<'1' | '2' | '3', '2' | '3' | '4'>;
|
|
19
|
-
*
|
|
20
|
-
* // Expect: string | number
|
|
21
|
-
* SetDifference<string | number | (() => void), Function>;
|
|
22
|
-
*/
|
|
23
|
-
type SetDifference<A, B> = A extends B ? never : A;
|
|
24
|
-
/**
|
|
25
|
-
* SetComplement
|
|
26
|
-
* @desc Set complement of given union types `A` and (it's subset) `A1`
|
|
27
|
-
* @example
|
|
28
|
-
* // Expect: "1"
|
|
29
|
-
* SetComplement<'1' | '2' | '3', '2' | '3'>;
|
|
30
|
-
*/
|
|
31
|
-
type SetComplement<A, A1 extends A> = SetDifference<A, A1>;
|
|
32
|
-
/**
|
|
33
|
-
* Subtract
|
|
34
|
-
* @desc From `T` remove properties that exist in `T1` (`T1` has a subset of the properties of `T`)
|
|
35
|
-
* @example
|
|
36
|
-
* type Props = { name: string; age: number; visible: boolean };
|
|
37
|
-
* type DefaultProps = { age: number };
|
|
38
|
-
*
|
|
39
|
-
* // Expect: { name: string; visible: boolean; }
|
|
40
|
-
* type RestProps = Subtract<Props, DefaultProps>;
|
|
41
|
-
*/
|
|
42
|
-
type Subtract<T extends T1, T1 extends object> = Pick<T, SetComplement<keyof T, keyof T1>>;
|
|
43
|
-
export {};
|
|
1
|
+
import type { KeycloakInstance } from 'keycloak-js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type InjectedProps = {
|
|
4
|
+
keycloakInitialized: boolean;
|
|
5
|
+
keycloak: KeycloakInstance;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* An HOC which injects the `keycloak` instance and the `keycloakInitialized` flag as props.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Please migrate to useKeycloak hook where/when possible.
|
|
11
|
+
*/
|
|
12
|
+
export declare function withKeycloak<P extends InjectedProps>(Component: React.ComponentType<P>): React.FC<Subtract<P, InjectedProps>>;
|
|
13
|
+
/**
|
|
14
|
+
* SetDifference (same as Exclude)
|
|
15
|
+
* @desc Set difference of given union types `A` and `B`
|
|
16
|
+
* @example
|
|
17
|
+
* // Expect: "1"
|
|
18
|
+
* SetDifference<'1' | '2' | '3', '2' | '3' | '4'>;
|
|
19
|
+
*
|
|
20
|
+
* // Expect: string | number
|
|
21
|
+
* SetDifference<string | number | (() => void), Function>;
|
|
22
|
+
*/
|
|
23
|
+
type SetDifference<A, B> = A extends B ? never : A;
|
|
24
|
+
/**
|
|
25
|
+
* SetComplement
|
|
26
|
+
* @desc Set complement of given union types `A` and (it's subset) `A1`
|
|
27
|
+
* @example
|
|
28
|
+
* // Expect: "1"
|
|
29
|
+
* SetComplement<'1' | '2' | '3', '2' | '3'>;
|
|
30
|
+
*/
|
|
31
|
+
type SetComplement<A, A1 extends A> = SetDifference<A, A1>;
|
|
32
|
+
/**
|
|
33
|
+
* Subtract
|
|
34
|
+
* @desc From `T` remove properties that exist in `T1` (`T1` has a subset of the properties of `T`)
|
|
35
|
+
* @example
|
|
36
|
+
* type Props = { name: string; age: number; visible: boolean };
|
|
37
|
+
* type DefaultProps = { age: number };
|
|
38
|
+
*
|
|
39
|
+
* // Expect: { name: string; visible: boolean; }
|
|
40
|
+
* type RestProps = Subtract<Props, DefaultProps>;
|
|
41
|
+
*/
|
|
42
|
+
type Subtract<T extends T1, T1 extends object> = Pick<T, SetComplement<keyof T, keyof T1>>;
|
|
43
|
+
export {};
|