@react-keycloak-refork/core 6.0.0 → 8.0.2
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 +149 -150
- package/lib/context.d.ts +23 -24
- package/lib/context.js +23 -23
- package/lib/index.d.ts +3 -3
- package/lib/index.js +4 -4
- package/lib/provider.d.ts +127 -132
- package/lib/provider.js +146 -145
- package/lib/provider.js.map +1 -1
- package/lib/types.d.ts +80 -80
- package/lib/types.js +1 -1
- package/lib-commonjs/context.d.ts +23 -24
- package/lib-commonjs/context.js +26 -27
- package/lib-commonjs/context.js.map +1 -1
- package/lib-commonjs/index.d.ts +3 -3
- package/lib-commonjs/index.js +20 -20
- package/lib-commonjs/provider.d.ts +127 -132
- package/lib-commonjs/provider.js +185 -175
- package/lib-commonjs/provider.js.map +1 -1
- package/lib-commonjs/types.d.ts +80 -80
- package/lib-commonjs/types.js +2 -2
- package/package.json +11 -7
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
|
@@ -1,150 +1,149 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
# React Keycloak (Keycloak >=v26 Fork) <!-- omit in toc -->
|
|
4
|
-
|
|
5
|
-
> React bindings for [Keycloak](https://www.keycloak.org/). Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for keycloak >=26 support.
|
|
6
|
-
|
|
7
|
-
⚠️ **IMPORTANT NOTICE**: This fork has been updated to support Keycloak 26, but it is **NOT MAINTAINED**. We strongly recommend migrating to [NextAuth.js](https://next-auth.js.org/) for new projects, as it provides better maintenance, security updates, and broader OAuth provider support.
|
|
8
|
-
|
|
9
|
-
[](https://img.shields.io/npm/v/@react-keycloak-
|
|
11
|
-
[](https://img.shields.io/npm/v/@react-keycloak-
|
|
13
|
-
|
|
14
|
-
[](https://github.com/react-keycloak/react-keycloak-fork/blob/master/LICENSE.md)
|
|
15
|
-
[](https://lerna.js.org/)
|
|
16
|
-
[](https://github.com/react-keycloak/react-keycloak-fork/graphs/contributors)
|
|
17
|
-
[](https://github.com/react-keycloak/react-keycloak/issues) ](https://gitter.im/react-keycloak/community)
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Table of Contents <!-- omit in toc -->
|
|
24
|
-
|
|
25
|
-
- [Integrations](#integrations)
|
|
26
|
-
- [React](#react)
|
|
27
|
-
- [SSR](#ssr)
|
|
28
|
-
- [React Native](#react-native)
|
|
29
|
-
- [Support](#support)
|
|
30
|
-
- [Examples](#examples)
|
|
31
|
-
- [Alternatives](#alternatives)
|
|
32
|
-
- [Contributing](#contributing)
|
|
33
|
-
- [License](#license)
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## Integrations
|
|
38
|
-
|
|
39
|
-
### React
|
|
40
|
-
|
|
41
|
-
React Keycloak for Web requires:
|
|
42
|
-
|
|
43
|
-
- React **
|
|
44
|
-
- `keycloak-js` **26.0.0** or later
|
|
45
|
-
|
|
46
|
-
```shell
|
|
47
|
-
yarn add @react-keycloak-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
or
|
|
51
|
-
|
|
52
|
-
```shell
|
|
53
|
-
npm install --save @react-keycloak-
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
or as a `UMD` package through `unpkg`
|
|
57
|
-
|
|
58
|
-
See `@react-keycloak-
|
|
59
|
-
|
|
60
|
-
### SSR
|
|
61
|
-
|
|
62
|
-
React Keycloak for SSR frameworks requires:
|
|
63
|
-
|
|
64
|
-
- React **
|
|
65
|
-
- SSR Framework:
|
|
66
|
-
- NextJS **9** or later
|
|
67
|
-
- Razzle **3** or later
|
|
68
|
-
- `keycloak-js` **26.0.0** or later
|
|
69
|
-
|
|
70
|
-
```shell
|
|
71
|
-
yarn add @react-keycloak-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
or
|
|
75
|
-
|
|
76
|
-
```shell
|
|
77
|
-
npm install --save @react-keycloak-
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
See `@react-keycloak-
|
|
81
|
-
|
|
82
|
-
### React Native
|
|
83
|
-
|
|
84
|
-
React Keycloak for React Native requires React Native **61.0** or later
|
|
85
|
-
|
|
86
|
-
To install run
|
|
87
|
-
|
|
88
|
-
```shell
|
|
89
|
-
yarn add @react-keycloak-
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
or
|
|
93
|
-
|
|
94
|
-
```shell
|
|
95
|
-
npm install --save @react-keycloak-
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
See `@react-keycloak-
|
|
99
|
-
|
|
100
|
-
## Support
|
|
101
|
-
|
|
102
|
-
| version | keycloak-js version | notes |
|
|
103
|
-
| ------- | ------------------- | ------ |
|
|
104
|
-
|
|
|
105
|
-
| v4.0.
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- [
|
|
119
|
-
- [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- ✅
|
|
127
|
-
- ✅
|
|
128
|
-
- ✅
|
|
129
|
-
- ✅
|
|
130
|
-
- ✅
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
MIT
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# React Keycloak (Keycloak >=v26 Fork) <!-- omit in toc -->
|
|
4
|
+
|
|
5
|
+
> React bindings for [Keycloak](https://www.keycloak.org/). Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for keycloak >=26 support.
|
|
6
|
+
|
|
7
|
+
⚠️ **IMPORTANT NOTICE**: This fork has been updated to support Keycloak 26, but it is **NOT MAINTAINED**. We strongly recommend migrating to [NextAuth.js](https://next-auth.js.org/) for new projects, as it provides better maintenance, security updates, and broader OAuth provider support.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@react-keycloak-fork/core)
|
|
10
|
+
[](https://www.npmjs.com/package/@react-keycloak-fork/web)
|
|
11
|
+
[](https://www.npmjs.com/package/@react-keycloak-fork/ssr)
|
|
12
|
+
[](https://www.npmjs.com/package/@react-keycloak-fork/native)
|
|
13
|
+
|
|
14
|
+
[](https://github.com/react-keycloak/react-keycloak-fork/blob/master/LICENSE.md)
|
|
15
|
+
[](https://lerna.js.org/)
|
|
16
|
+
[](https://github.com/react-keycloak/react-keycloak-fork/graphs/contributors)
|
|
17
|
+
[](https://github.com/react-keycloak/react-keycloak/issues) 
|
|
18
|
+
|
|
19
|
+
[](https://gitter.im/react-keycloak/community)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Table of Contents <!-- omit in toc -->
|
|
24
|
+
|
|
25
|
+
- [Integrations](#integrations)
|
|
26
|
+
- [React](#react)
|
|
27
|
+
- [SSR](#ssr)
|
|
28
|
+
- [React Native](#react-native)
|
|
29
|
+
- [Support](#support)
|
|
30
|
+
- [Examples](#examples)
|
|
31
|
+
- [Alternatives](#alternatives)
|
|
32
|
+
- [Contributing](#contributing)
|
|
33
|
+
- [License](#license)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Integrations
|
|
38
|
+
|
|
39
|
+
### React
|
|
40
|
+
|
|
41
|
+
React Keycloak for Web requires:
|
|
42
|
+
|
|
43
|
+
- React **19.0** or later
|
|
44
|
+
- `keycloak-js` **26.0.0** or later
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
yarn add @react-keycloak-fork/web
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
or
|
|
51
|
+
|
|
52
|
+
```shell
|
|
53
|
+
npm install --save @react-keycloak-fork/web
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
or as a `UMD` package through `unpkg`
|
|
57
|
+
|
|
58
|
+
See `@react-keycloak-fork/web` package [README](https://github.com/react-keycloak/react-keycloak/blob/master/packages/web/README.md) for complete documentation.
|
|
59
|
+
|
|
60
|
+
### SSR
|
|
61
|
+
|
|
62
|
+
React Keycloak for SSR frameworks requires:
|
|
63
|
+
|
|
64
|
+
- React **19.0** or later
|
|
65
|
+
- SSR Framework:
|
|
66
|
+
- NextJS **9** or later
|
|
67
|
+
- Razzle **3** or later
|
|
68
|
+
- `keycloak-js` **26.0.0** or later
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
yarn add @react-keycloak-fork/ssr
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
or
|
|
75
|
+
|
|
76
|
+
```shell
|
|
77
|
+
npm install --save @react-keycloak-fork/ssr
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
See `@react-keycloak-fork/ssr` package [README](https://github.com/react-keycloak/react-keycloak/blob/master/packages/ssr/README.md) for complete documentation.
|
|
81
|
+
|
|
82
|
+
### React Native
|
|
83
|
+
|
|
84
|
+
React Keycloak for React Native requires React Native **61.0** or later
|
|
85
|
+
|
|
86
|
+
To install run
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
yarn add @react-keycloak-fork/native
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
or
|
|
93
|
+
|
|
94
|
+
```shell
|
|
95
|
+
npm install --save @react-keycloak-fork/native
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See `@react-keycloak-fork/native` package [README](https://github.com/react-keycloak/react-native-keycloak/blob/master/README.md) for complete documentation.
|
|
99
|
+
|
|
100
|
+
## Support
|
|
101
|
+
|
|
102
|
+
| version | keycloak-js version | notes |
|
|
103
|
+
| ------- | ------------------- | ------ |
|
|
104
|
+
| v4.0.3+ | 26.0.0+ | (fork) |
|
|
105
|
+
| v4.0.1+ | 17.0.0+ | (fork) |
|
|
106
|
+
| v2.0.0+ | 9.0.2+ |
|
|
107
|
+
| v1.x | >=8.0.2 <9.0.2 |
|
|
108
|
+
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
See [`@react-keycloak-fork/react-keycloak-examples`](https://github.com/react-keycloak/react-keycloak-examples) repository for various demo implementing this library main features.
|
|
112
|
+
|
|
113
|
+
## Alternatives
|
|
114
|
+
|
|
115
|
+
If you need to connect using a more generic OIDC client instead of `keycloak.js`, consider using one of the following libraries:
|
|
116
|
+
|
|
117
|
+
- [bjerkio/oidc-react](https://github.com/bjerkio/oidc-react)
|
|
118
|
+
- [thchia/react-oidc](https://github.com/thchia/react-oidc)
|
|
119
|
+
- [@axa-fr/react-oidc](https://github.com/AxaGuilDEv/react-oidc)
|
|
120
|
+
|
|
121
|
+
## Migration Notice
|
|
122
|
+
|
|
123
|
+
⚠️ **This project is no longer maintained**. For new projects, we strongly recommend using [NextAuth.js](https://next-auth.js.org/) instead, which provides:
|
|
124
|
+
|
|
125
|
+
- ✅ Active maintenance and security updates
|
|
126
|
+
- ✅ Support for 50+ OAuth providers including Keycloak
|
|
127
|
+
- ✅ Better TypeScript support
|
|
128
|
+
- ✅ Modern React patterns and hooks
|
|
129
|
+
- ✅ Comprehensive documentation and examples
|
|
130
|
+
- ✅ Active community and support
|
|
131
|
+
|
|
132
|
+
### Migrating to NextAuth.js
|
|
133
|
+
|
|
134
|
+
To migrate from this library to NextAuth.js with Keycloak:
|
|
135
|
+
|
|
136
|
+
1. Install NextAuth.js: `npm install next-auth`
|
|
137
|
+
2. Configure Keycloak as a provider in your NextAuth configuration
|
|
138
|
+
3. Replace `useKeycloak()` hooks with NextAuth's `useSession()` and `signIn()`/`signOut()` functions
|
|
139
|
+
4. Update your authentication logic to use NextAuth's session management
|
|
140
|
+
|
|
141
|
+
See the [NextAuth.js documentation](https://next-auth.js.org/configuration/providers/keycloak) for detailed migration instructions.
|
|
142
|
+
|
|
143
|
+
## Contributing
|
|
144
|
+
|
|
145
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
MIT
|
package/lib/context.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
-
export default createAuthContext;
|
|
1
|
+
import { AuthClient } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Auth Context props
|
|
4
|
+
*/
|
|
5
|
+
export type IAuthContextProps<T extends AuthClient> = {
|
|
6
|
+
/**
|
|
7
|
+
* The single AuthClient of your application.
|
|
8
|
+
*/
|
|
9
|
+
authClient?: T;
|
|
10
|
+
/**
|
|
11
|
+
* Boolean indicating whenever the AuthClient has been initialized by AuthProvider
|
|
12
|
+
*/
|
|
13
|
+
initialized: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Create a React context containing an AuthClient instance.
|
|
17
|
+
*
|
|
18
|
+
* @param {IAuthContextProps} initialContext initial context value.
|
|
19
|
+
*
|
|
20
|
+
* @returns {React.Context} the ReactKeycloak context.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createAuthContext<T extends AuthClient>(initialContext?: Partial<IAuthContextProps<T>>): React.Context<IAuthContextProps<T>>;
|
|
23
|
+
export default createAuthContext;
|
package/lib/context.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { createContext } from 'react';
|
|
13
|
-
/**
|
|
14
|
-
* Create a React context containing an AuthClient instance.
|
|
15
|
-
*
|
|
16
|
-
* @param {IAuthContextProps} initialContext initial context value.
|
|
17
|
-
*
|
|
18
|
-
* @returns {React.Context} the ReactKeycloak context.
|
|
19
|
-
*/
|
|
20
|
-
export function createAuthContext(initialContext) {
|
|
21
|
-
return createContext(__assign({ initialized: false }, initialContext));
|
|
22
|
-
}
|
|
23
|
-
export default createAuthContext;
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { createContext } from 'react';
|
|
13
|
+
/**
|
|
14
|
+
* Create a React context containing an AuthClient instance.
|
|
15
|
+
*
|
|
16
|
+
* @param {IAuthContextProps} initialContext initial context value.
|
|
17
|
+
*
|
|
18
|
+
* @returns {React.Context} the ReactKeycloak context.
|
|
19
|
+
*/
|
|
20
|
+
export function createAuthContext(initialContext) {
|
|
21
|
+
return createContext(__assign({ initialized: false }, initialContext));
|
|
22
|
+
}
|
|
23
|
+
export default createAuthContext;
|
|
24
24
|
//# sourceMappingURL=context.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './context';
|
|
2
|
-
export * from './provider';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './context';
|
|
2
|
+
export * from './provider';
|
|
3
|
+
export * from './types';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* istanbul ignore file */
|
|
2
|
-
export * from './context';
|
|
3
|
-
export * from './provider';
|
|
4
|
-
export * from './types';
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
export * from './context';
|
|
3
|
+
export * from './provider';
|
|
4
|
+
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|