@axa-fr/react-oidc 6.26.6 → 7.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.
Files changed (47) hide show
  1. package/README.md +79 -69
  2. package/dist/FetchToken.d.ts +0 -1
  3. package/dist/OidcProvider.d.ts +2 -3
  4. package/dist/OidcSecure.d.ts +0 -1
  5. package/dist/ReactOidc.d.ts +0 -1
  6. package/dist/User.d.ts +0 -1
  7. package/dist/core/default-component/AuthenticateError.component.d.ts +0 -1
  8. package/dist/core/default-component/Authenticating.component.d.ts +0 -1
  9. package/dist/core/default-component/Callback.component.d.ts +0 -1
  10. package/dist/core/default-component/Loading.component.d.ts +0 -1
  11. package/dist/core/default-component/ServiceWorkerNotSupported.component.d.ts +0 -1
  12. package/dist/core/default-component/SessionLost.component.d.ts +0 -1
  13. package/dist/core/default-component/SilentCallback.component.d.ts +0 -1
  14. package/dist/core/default-component/SilentLogin.component.d.ts +0 -1
  15. package/dist/core/default-component/index.d.ts +0 -1
  16. package/dist/core/routes/OidcRoutes.d.ts +0 -1
  17. package/dist/core/routes/index.d.ts.map +1 -1
  18. package/dist/core/routes/withRouter.d.ts +0 -1
  19. package/dist/index.d.ts +0 -1
  20. package/dist/index.js +42 -42
  21. package/dist/index.umd.cjs +9 -9
  22. package/package.json +3 -3
  23. package/src/FetchToken.tsx +3 -3
  24. package/src/OidcProvider.tsx +19 -19
  25. package/src/OidcSecure.tsx +2 -2
  26. package/src/ReactOidc.tsx +19 -19
  27. package/src/User.ts +2 -2
  28. package/src/core/default-component/Callback.component.tsx +2 -2
  29. package/src/core/default-component/SilentCallback.component.tsx +2 -2
  30. package/src/core/default-component/SilentLogin.component.tsx +2 -2
  31. package/dist/FetchToken.d.ts.map +0 -1
  32. package/dist/OidcProvider.d.ts.map +0 -1
  33. package/dist/OidcSecure.d.ts.map +0 -1
  34. package/dist/ReactOidc.d.ts.map +0 -1
  35. package/dist/User.d.ts.map +0 -1
  36. package/dist/core/default-component/AuthenticateError.component.d.ts.map +0 -1
  37. package/dist/core/default-component/Authenticating.component.d.ts.map +0 -1
  38. package/dist/core/default-component/Callback.component.d.ts.map +0 -1
  39. package/dist/core/default-component/Loading.component.d.ts.map +0 -1
  40. package/dist/core/default-component/ServiceWorkerNotSupported.component.d.ts.map +0 -1
  41. package/dist/core/default-component/SessionLost.component.d.ts.map +0 -1
  42. package/dist/core/default-component/SilentCallback.component.d.ts.map +0 -1
  43. package/dist/core/default-component/SilentLogin.component.d.ts.map +0 -1
  44. package/dist/core/default-component/index.d.ts.map +0 -1
  45. package/dist/core/routes/OidcRoutes.d.ts.map +0 -1
  46. package/dist/core/routes/withRouter.d.ts.map +0 -1
  47. package/dist/index.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,13 +1,21 @@
1
1
  # @axa-fr/react-oidc
2
2
 
3
- [![Continuous Integration](https://github.com/AxaGuilDEv/react-oidc/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/AxaGuilDEv/react-oidc/actions/workflows/npm-publish.yml)
3
+ [![Continuous Integration](https://github.com/AxaFrance/react-oidc/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/AxaFrance/react-oidc/actions/workflows/npm-publish.yml)
4
4
  [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=AxaGuilDEv_react-oidc&metric=alert_status)](https://sonarcloud.io/dashboard?id=AxaGuilDEv_react-oidc) [![Reliability](https://sonarcloud.io/api/project_badges/measure?project=AxaGuilDEv_react-oidc&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=AxaGuilDEv_react-oidc&metric=reliability_rating) [![Security](https://sonarcloud.io/api/project_badges/measure?project=AxaGuilDEv_react-oidc&metric=security_rating)](https://sonarcloud.io/component_measures?id=AxaGuilDEv_react-oidc&metric=security_rating) [![Code Corevage](https://sonarcloud.io/api/project_badges/measure?project=AxaGuilDEv_react-oidc&metric=coverage)](https://sonarcloud.io/component_measures?id=AxaGuilDEv_react-oidc&metric=Coverage) [![Twitter](https://img.shields.io/twitter/follow/GuildDEvOpen?style=social)](https://twitter.com/intent/follow?screen_name=GuildDEvOpen)
5
5
 
6
- Try the demo at https://black-rock-0dc6b0d03.1.azurestaticapps.net/
6
+ **@axa-fr/oidc-client** the lightest and securest library to manage authentication with OpenID Connect (OIDC) and OAuth2 protocol. It is compatible with all OIDC providers.
7
+ **@axa-fr/oidc-client** is a pure javascript library. It works with any JavaScript framework or library.
7
8
 
8
- ![Sample React OIDC](https://github.com/AxaGuilDEv/react-oidc/blob/master/docs/img/introduction.gif?raw=true)
9
+ We provide a wrapper **@axa-fr/react-oidc** for **React** (compatible next.js) and we expect soon to provide one for **Vue**, **Angular** and **Svelte**.
9
10
 
10
- A set of react components to make OIDC (OpenID Connect) client easy. It aim to simplify OAuth authentication between multiples providers.
11
+ - Try the react demo at https://black-rock-0dc6b0d03.1.azurestaticapps.net/ (most advanced)
12
+ - Try the pure javascript demo at https://icy-glacier-004ab4303.2.azurestaticapps.net/
13
+
14
+ <p align="center">
15
+ <img src="https://github.com/AxaFrance/react-oidc/blob/master/docs/img/introduction.gif?raw=true"
16
+ alt="Sample React Oicd"
17
+ />
18
+ </p>
11
19
 
12
20
  - [About](#about)
13
21
  - [Getting Started](#getting-started)
@@ -20,22 +28,21 @@ A set of react components to make OIDC (OpenID Connect) client easy. It aim to s
20
28
 
21
29
  ## About
22
30
 
23
- Easy set up of OIDC for react.
24
- It is a real alternative to existing oidc-client libraries.
31
+ @axa-fr/react is:
25
32
 
26
33
  - **Secure** :
27
- - With the use of Service Worker, your tokens (refresh_token and access_token) are not accessible to the JavaScript client code (big protection against XSRF attacks)
28
- - OIDC using client side Code Credential Grant with PKCE only
29
- - **Lightweight**
30
- - **Simple** :
34
+ - With the use of Service Worker, your tokens (refresh_token and access_token) are not accessible to the JavaScript client code (big protection against XSS attacks)
35
+ - OIDC using client side Code Credential Grant with pkce only
36
+ - **Lightweight** : Unpacked Size on npm is **274 kB**
37
+ - **Simple**
31
38
  - refresh_token and access_token are auto refreshed in background
32
- - with the use of the Service Worker, you do not need to inject the access_token in every fetch, you have only to configure `OidcTrustedDomains.js` file
33
- - **No cookies problem** : You can disable silent signin (that internally use an iframe). For your information, your OIDC server should be in the same domain of your website in order to be able to send OIDC server cookies from your website via an internal IFRAME, else, you may encounter COOKIES problem.
39
+ - with the use of the Service Worker, you do not need to inject the access_token in every fetch, you have only to configure OidcTrustedDomains.js file
34
40
  - **Multiple Authentication** :
35
41
  - You can authenticate many times to the same provider with different scope (for example you can acquire a new 'payment' scope for a payment)
36
42
  - You can authenticate to multiple different providers inside the same SPA (single page application) website
37
43
  - **Flexible** :
38
- - Work with Service Worker (more secure) and without for older browser (less secure)
44
+ - Work with Service Worker (more secure) and without for older browser (less secure).
45
+ - You can disable Service Worker if you want (but less secure) and just use SessionStorage or LocalStorage mode.
39
46
 
40
47
  ![](https://github.com/AxaGuilDEv/react-oidc/blob/master/docs/img/schema_pcke_client_side_with_service_worker.png?raw=true)
41
48
 
@@ -63,23 +70,32 @@ The only file you should edit is "OidcTrustedDomains.js".
63
70
 
64
71
  // Domains used by OIDC server must be also declared here
65
72
  const trustedDomains = {
66
- default: ["https://demo.duendesoftware.com", "https://www.myapi.com/users"],
73
+ default: {
74
+ oidcDomains :["https://demo.duendesoftware.com"],
75
+ accessTokenDomains : ["https://www.myapi.com/users"]
76
+ },
67
77
  };
68
78
 
69
79
  // Service worker will continue to give access token to the JavaScript client
70
80
  // Ideal to hide refresh token from client JavaScript, but to retrieve access_token for some
71
81
  // scenarios which require it. For example, to send it via websocket connection.
72
- trustedDomains.config_show_access_token = { domains : ["https://demo.duendesoftware.com"], showAccessToken: true };
82
+ trustedDomains.config_show_access_token = {
83
+ oidcDomains :["https://demo.duendesoftware.com"],
84
+ accessTokenDomains : ["https://www.myapi.com/users"],
85
+ showAccessToken: true
86
+ };
73
87
 
74
88
  ```
75
89
 
76
90
  ## Run The Demo
77
91
 
78
92
  ```sh
79
- git clone https://github.com/AxaGuilDEv/react-oidc.git
80
- cd react-oidc/packages/react
81
- npm install
82
- npm start
93
+ git clone https://github.com/AxaFrance/oidc-client.git
94
+ cd oidc-client
95
+ pnpm install
96
+ cd /examples/react-oidc-demo
97
+ pnpm install
98
+ pnpm start
83
99
  # then navigate to http://localhost:4200
84
100
  ```
85
101
 
@@ -111,7 +127,7 @@ const configuration = {
111
127
  window.location.origin + "/authentication/silent-callback",
112
128
  scope: "openid profile email api offline_access", // offline_access scope allow your client to retrieve the refresh_token
113
129
  authority: "https://demo.duendesoftware.com",
114
- service_worker_relative_url: "/OidcServiceWorker.js",
130
+ service_worker_relative_url: "/OidcServiceWorker.js", // just comment that line to disable service worker mode
115
131
  service_worker_only: false,
116
132
  };
117
133
 
@@ -128,49 +144,50 @@ render(<App />, document.getElementById("root"));
128
144
  ```
129
145
 
130
146
  ```javascript
131
- const propTypes = {
132
- loadingComponent: PropTypes.elementType, // you can inject your own loading component
133
- sessionLostComponent: PropTypes.elementType, // you can inject your own session lost component
134
- authenticating: PropTypes.elementType, // you can inject your own authenticationg component
135
- authenticatingErrorComponent: PropTypes.elementType,
136
- callbackSuccessComponent: PropTypes.elementType, // you can inject your own call back success component
137
- serviceWorkerNotSupportedComponent: PropTypes.elementType, // you can inject your page that explain your require a more modern browser
138
- onSessionLost: PropTypes.function, // If set "sessionLostComponent" is not displayed and onSessionLost callback is called instead
139
- configuration: PropTypes.shape({
140
- client_id: PropTypes.string.isRequired, // oidc client id
141
- redirect_uri: PropTypes.string.isRequired, // oidc redirect url
142
- silent_redirect_uri: PropTypes.string, // Optional activate silent-signin that use cookies between OIDC server and client javascript to restore sessions
143
- silent_login_uri: PropTypes.string, // Optional, route that trigger the signin
144
- silent_login_timeout: PropTypes.number, // Optional default is 12000 milliseconds
145
- scope: PropTypes.string.isRequired, // oidc scope (you need to set "offline_access")
146
- authority: PropTypes.string.isRequired,
147
- storage: Storage, // Default sessionStorage, you can set localStorage but it is less secure to XSS attacks
148
- authority_configuration: PropTypes.shape({
149
- // Optional for providers that does not implement OIDC server auto discovery via a .wellknowurl
150
- authorization_endpoint: PropTypes.string,
151
- token_endpoint: PropTypes.string,
152
- userinfo_endpoint: PropTypes.string,
153
- end_session_endpoint: PropTypes.string,
154
- revocation_endpoint: PropTypes.string,
155
- check_session_iframe: PropTypes.string,
156
- issuer: PropTypes.string,
157
- }),
158
- refresh_time_before_tokens_expiration_in_second: PropTypes.number, // default is 120 seconds
159
- service_worker_relative_url: PropTypes.string,
160
- service_worker_only: PropTypes.boolean, // default false
161
- service_worker_convert_all_requests_to_cors: PropTypes.boolean, // force all requests that servie worker upgrades to have 'cors' mode. This allows setting authentication token on requests initialted by html parsing(e.g. img tags, download links etc).
162
- extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that are send to the oidc server (more info: https://github.com/openid/AppAuth-JS)
163
- token_request_extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that are send to the oidc server during token request (more info: https://github.com/openid/AppAuth-JS)
164
- withCustomHistory: PropTypes.function, // Override history modification, return instance with replaceState(url, stateHistory) implemented (like History.replaceState())
165
- authority_time_cache_wellknowurl_in_second: 60 * 60, // Time to cache in second of openid wellknowurl, default is 1 hour
166
- authority_timeout_wellknowurl_in_millisecond: 10000, // Timeout in millisecond of openid wellknowurl, default is 10 seconds, then error is throwed
167
- monitor_session: PropTypes.boolean, // Add OpenId monitor session, default is false (more information https://openid.net/specs/openid-connect-session-1_0.html), if you need to set it to true consider https://infi.nl/nieuws/spa-necromancy/
168
- onLogoutFromAnotherTab: Function, // Optional, can be set to override the default behavior, this function is triggered when user with the same subject is logged out from another tab when session_monitor is active
169
- onLogoutFromSameTab: Function, // Optional, can be set to override the default behavior, this function is triggered when user is logged out from same tab when session_monitor is active
170
- token_renew_mode: PropTypes.string, // Optional, update tokens base on the selected token(s) lifetime: "access_token_or_id_token_invalid" (default), "access_token_invalid" , "id_token_invalid"
171
- logout_tokens_to_invalidate : Array<string> // Optional tokens to invalidate during logout, default: ['access_token', 'refresh_token']
172
- }).isRequired,
147
+ const configuration = {
148
+ loadingComponent: ReactComponent, // you can inject your own loading component
149
+ sessionLostComponent: ReactComponent, // you can inject your own session lost component
150
+ authenticating: ReactComponent, // you can inject your own authenticating component
151
+ authenticatingErrorComponent: ReactComponent,
152
+ callbackSuccessComponent: ReactComponent, // you can inject your own call back success component
153
+ serviceWorkerNotSupportedComponent: ReactComponent, // you can inject your page that explains you require a more modern browser
154
+ onSessionLost: Function, // If set, "sessionLostComponent" is not displayed, and onSessionLost callback is called instead
155
+ configuration: {
156
+ client_id: String.isRequired, // oidc client id
157
+ redirect_uri: String.isRequired, // oidc redirect url
158
+ silent_redirect_uri: String, // Optional activate silent-signin that use cookies between OIDC server and client javascript to restore sessions
159
+ silent_login_uri: String, // Optional, route that triggers the signin
160
+ silent_login_timeout: Number, // Optional, default is 12000 milliseconds
161
+ scope: String.isRequired, // oidc scope (you need to set "offline_access")
162
+ authority: String.isRequired,
163
+ storage: Storage, // Default sessionStorage, you can set localStorage, but it is less secure against XSS attacks
164
+ authority_configuration: {
165
+ // Optional for providers that do not implement OIDC server auto-discovery via a .wellknown URL
166
+ authorization_endpoint: String,
167
+ token_endpoint: String,
168
+ userinfo_endpoint: String,
169
+ end_session_endpoint: String,
170
+ revocation_endpoint: String,
171
+ check_session_iframe: String,
172
+ issuer: String,
173
+ },
174
+ refresh_time_before_tokens_expiration_in_second: Number, // default is 120 seconds
175
+ service_worker_relative_url: String,
176
+ service_worker_only: Boolean, // default false
177
+ service_worker_convert_all_requests_to_cors: Boolean, // force all requests that service worker upgrades to have 'cors' mode. This allows setting an authentication token on requests initiated by HTML parsing (e.g., img tags, download links, etc.).
178
+ extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that is sent to the OIDC server (more info: https://github.com/openid/AppAuth-JS)
179
+ token_request_extras: StringMap | undefined, // ex: {'prompt': 'consent', 'access_type': 'offline'} list of key/value that is sent to the OIDC server during token request (more info: https://github.com/openid/AppAuth-JS)
180
+ withCustomHistory: Function, // Override history modification, return an instance with replaceState(url, stateHistory) implemented (like History.replaceState())
181
+ authority_time_cache_wellknowurl_in_second: 60 * 60, // Time to cache in seconds of the openid well-known URL, default is 1 hour
182
+ authority_timeout_wellknowurl_in_millisecond: 10000, // Timeout in milliseconds of the openid well-known URL, default is 10 seconds, then an error is thrown
183
+ monitor_session: Boolean, // Add OpenID monitor session, default is false (more information https://openid.net/specs/openid-connect-session-1_0.html), if you need to set it to true consider https://infi.nl/nieuws/spa-necromancy/
184
+ onLogoutFromAnotherTab: Function, // Optional, can be set to override the default behavior, this function is triggered when a user with the same subject is logged out from another tab when session_monitor is active
185
+ onLogoutFromSameTab: Function, // Optional, can be set to override the default behavior, this function is triggered when a user is logged out from the same tab when session_monitor is active
186
+ token_renew_mode: String, // Optional, update tokens based on the selected token(s) lifetime: "access_token_or_id_token_invalid" (default), "access_token_invalid", "id_token_invalid"
187
+ logout_tokens_to_invalidate: Array<string>, // Optional tokens to invalidate during logout, default: ['access_token', 'refresh_token']
188
+ }.isRequired,
173
189
  };
190
+
174
191
  ```
175
192
 
176
193
  ## How to consume
@@ -626,10 +643,3 @@ export const configurationIdentityServerWithHash = {
626
643
  service_worker_only: false,
627
644
  };
628
645
  ```
629
-
630
- ## Service Worker Support
631
-
632
- - Firefox : tested on Firefox 98.0.2
633
- - Chrome/Edge : tested on version upper to 90
634
- - Opera : tested on version upper to 80
635
- - Safari : tested on Safari/605.1.15
@@ -6,4 +6,3 @@ export declare const withOidcFetch: (fetch?: Fetch, configurationName?: string)
6
6
  export declare const useOidcFetch: (fetch?: Fetch, configurationName?: string) => {
7
7
  fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
8
8
  };
9
- //# sourceMappingURL=FetchToken.d.ts.map
@@ -1,8 +1,8 @@
1
- import { Fetch, OidcConfiguration, VanillaOidc } from '@axa-fr/oidc-client';
1
+ import { Fetch, OidcConfiguration, OidcClient } from '@axa-fr/oidc-client';
2
2
  import { ComponentType, FC, PropsWithChildren } from 'react';
3
3
  import { CustomHistory } from './core/routes/withRouter.js';
4
4
  export type oidcContext = {
5
- (name?: string): VanillaOidc;
5
+ (name?: string): OidcClient;
6
6
  };
7
7
  export type OidcProviderProps = {
8
8
  callbackSuccessComponent?: ComponentType<any>;
@@ -27,4 +27,3 @@ export type OidcSessionProps = {
27
27
  };
28
28
  export declare const OidcProvider: FC<PropsWithChildren<OidcProviderProps>>;
29
29
  export default OidcProvider;
30
- //# sourceMappingURL=OidcProvider.d.ts.map
@@ -7,4 +7,3 @@ export type OidcSecureProps = {
7
7
  };
8
8
  export declare const OidcSecure: FC<PropsWithChildren<OidcSecureProps>>;
9
9
  export declare const withOidcSecure: (WrappedComponent: FC<PropsWithChildren<OidcSecureProps>>, callbackPath?: any, extras?: any, configurationName?: string) => (props: any) => import("react/jsx-runtime").JSX.Element;
10
- //# sourceMappingURL=OidcSecure.d.ts.map
@@ -15,4 +15,3 @@ export type OidcIdToken = {
15
15
  idTokenPayload?: any;
16
16
  };
17
17
  export declare const useOidcIdToken: (configurationName?: string) => OidcIdToken;
18
- //# sourceMappingURL=ReactOidc.d.ts.map
package/dist/User.d.ts CHANGED
@@ -14,4 +14,3 @@ export declare const useOidcUser: <T extends OidcUserInfo = OidcUserInfo>(config
14
14
  oidcUserLoadingState: OidcUserStatus;
15
15
  reloadOidcUser: () => void;
16
16
  };
17
- //# sourceMappingURL=User.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  declare const AuthenticatingError: ComponentType<any>;
3
3
  export default AuthenticatingError;
4
- //# sourceMappingURL=AuthenticateError.component.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  declare const Authenticating: ComponentType<any>;
3
3
  export default Authenticating;
4
- //# sourceMappingURL=Authenticating.component.d.ts.map
@@ -2,4 +2,3 @@ import { ComponentType } from 'react';
2
2
  export declare const CallBackSuccess: ComponentType<any>;
3
3
  declare const CallbackManager: ComponentType<any>;
4
4
  export default CallbackManager;
5
- //# sourceMappingURL=Callback.component.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  declare const Loading: ComponentType<any>;
3
3
  export default Loading;
4
- //# sourceMappingURL=Loading.component.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  declare const ServiceWorkerNotSupported: ComponentType<any>;
3
3
  export default ServiceWorkerNotSupported;
4
- //# sourceMappingURL=ServiceWorkerNotSupported.component.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  export declare const SessionLost: ComponentType<any>;
3
3
  export default SessionLost;
4
- //# sourceMappingURL=SessionLost.component.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  declare const SilentCallbackManager: ComponentType<any>;
3
3
  export default SilentCallbackManager;
4
- //# sourceMappingURL=SilentCallback.component.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import { ComponentType } from 'react';
2
2
  declare const SilentLogin: ComponentType<any>;
3
3
  export default SilentLogin;
4
- //# sourceMappingURL=SilentLogin.component.d.ts.map
@@ -4,4 +4,3 @@ export { default as Callback, CallBackSuccess } from './Callback.component.js';
4
4
  export { default as Loading } from './Loading.component.js';
5
5
  export { default as ServiceWorkerNotSupported } from './ServiceWorkerNotSupported.component.js';
6
6
  export { default as SessionLost } from './SessionLost.component.js';
7
- //# sourceMappingURL=index.d.ts.map
@@ -12,4 +12,3 @@ type OidcRoutesProps = {
12
12
  };
13
13
  declare const _default: React.NamedExoticComponent<React.PropsWithChildren<OidcRoutesProps>>;
14
14
  export default _default;
15
- //# sourceMappingURL=OidcRoutes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/core/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
@@ -17,4 +17,3 @@ export type CustomHistory = {
17
17
  };
18
18
  export declare const getCustomHistory: () => CustomHistory;
19
19
  export {};
20
- //# sourceMappingURL=withRouter.d.ts.map
package/dist/index.d.ts CHANGED
@@ -5,4 +5,3 @@ export { useOidc, useOidcAccessToken, useOidcIdToken } from './ReactOidc.js';
5
5
  export { OidcUserStatus, useOidcUser } from './User.js';
6
6
  export type { AuthorityConfiguration, Fetch, OidcConfiguration, StringMap, } from '@axa-fr/oidc-client';
7
7
  export { type OidcUserInfo, TokenRenewMode } from '@axa-fr/oidc-client';
8
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import be, { useCallback as kt, useState as P, useEffect as O } from "react";
2
- import { VanillaOidc as f, getParseQueryStringFromLocation as mt, getPath as z, getFetchDefault as Et } from "@axa-fr/oidc-client";
2
+ import { OidcClient as f, getParseQueryStringFromLocation as mt, getPath as z, getFetchDefault as Et } from "@axa-fr/oidc-client";
3
3
  import { TokenRenewMode as rr } from "@axa-fr/oidc-client";
4
4
  var ye = { exports: {} }, G = {};
5
5
  /**
@@ -18,14 +18,14 @@ function Tt() {
18
18
  Ye = 1;
19
19
  var o = be, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, u = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
20
20
  function h(c, v, g) {
21
- var b, m = {}, R = null, D = null;
22
- g !== void 0 && (R = "" + g), v.key !== void 0 && (R = "" + v.key), v.ref !== void 0 && (D = v.ref);
21
+ var b, m = {}, C = null, D = null;
22
+ g !== void 0 && (C = "" + g), v.key !== void 0 && (C = "" + v.key), v.ref !== void 0 && (D = v.ref);
23
23
  for (b in v)
24
24
  a.call(v, b) && !l.hasOwnProperty(b) && (m[b] = v[b]);
25
25
  if (c && c.defaultProps)
26
26
  for (b in v = c.defaultProps, v)
27
27
  m[b] === void 0 && (m[b] = v[b]);
28
- return { $$typeof: s, type: c, key: R, ref: D, props: m, _owner: u.current };
28
+ return { $$typeof: s, type: c, key: C, ref: D, props: m, _owner: u.current };
29
29
  }
30
30
  return G.Fragment = r, G.jsx = h, G.jsxs = h, G;
31
31
  }
@@ -42,7 +42,7 @@ var H = {};
42
42
  var Me;
43
43
  function wt() {
44
44
  return Me || (Me = 1, process.env.NODE_ENV !== "production" && function() {
45
- var o = be, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), c = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), K = Symbol.iterator, U = "@@iterator";
45
+ var o = be, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), c = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), K = Symbol.iterator, U = "@@iterator";
46
46
  function ne(e) {
47
47
  if (e === null || typeof e != "object")
48
48
  return null;
@@ -50,7 +50,7 @@ function wt() {
50
50
  return typeof t == "function" ? t : null;
51
51
  }
52
52
  var L = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
53
- function C(e) {
53
+ function R(e) {
54
54
  {
55
55
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), d = 1; d < t; d++)
56
56
  n[d - 1] = arguments[d];
@@ -70,7 +70,7 @@ function wt() {
70
70
  var oe = !1, se = !1, ae = !1, ie = !1, W = !1, X;
71
71
  X = Symbol.for("react.module.reference");
72
72
  function ce(e) {
73
- return !!(typeof e == "string" || typeof e == "function" || e === a || e === l || W || e === u || e === g || e === b || ie || e === D || oe || se || ae || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === m || e.$$typeof === h || e.$$typeof === c || e.$$typeof === v || // This needs to include all possible module reference object
73
+ return !!(typeof e == "string" || typeof e == "function" || e === a || e === l || W || e === u || e === g || e === b || ie || e === D || oe || se || ae || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === m || e.$$typeof === h || e.$$typeof === c || e.$$typeof === v || // This needs to include all possible module reference object
74
74
  // types supported by any Flight configuration anywhere since
75
75
  // we don't know which Flight build this will end up being used
76
76
  // with.
@@ -89,7 +89,7 @@ function wt() {
89
89
  function A(e) {
90
90
  if (e == null)
91
91
  return null;
92
- if (typeof e.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
92
+ if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
93
93
  return e.displayName || e.name || null;
94
94
  if (typeof e == "string")
95
95
  return e;
@@ -120,7 +120,7 @@ function wt() {
120
120
  case m:
121
121
  var d = e.displayName || null;
122
122
  return d !== null ? d : A(e.type) || "Memo";
123
- case R: {
123
+ case C: {
124
124
  var y = e, k = y._payload, _ = y._init;
125
125
  try {
126
126
  return A(_(k));
@@ -131,18 +131,18 @@ function wt() {
131
131
  }
132
132
  return null;
133
133
  }
134
- var S = Object.assign, F = 0, T, N, me, Ee, Te, we, Re;
135
- function Ce() {
134
+ var S = Object.assign, F = 0, T, N, me, Ee, Te, we, Ce;
135
+ function Re() {
136
136
  }
137
- Ce.__reactDisabledLog = !0;
137
+ Re.__reactDisabledLog = !0;
138
138
  function Je() {
139
139
  {
140
140
  if (F === 0) {
141
- T = console.log, N = console.info, me = console.warn, Ee = console.error, Te = console.group, we = console.groupCollapsed, Re = console.groupEnd;
141
+ T = console.log, N = console.info, me = console.warn, Ee = console.error, Te = console.group, we = console.groupCollapsed, Ce = console.groupEnd;
142
142
  var e = {
143
143
  configurable: !0,
144
144
  enumerable: !0,
145
- value: Ce,
145
+ value: Re,
146
146
  writable: !0
147
147
  };
148
148
  Object.defineProperties(console, {
@@ -186,11 +186,11 @@ function wt() {
186
186
  value: we
187
187
  }),
188
188
  groupEnd: S({}, e, {
189
- value: Re
189
+ value: Ce
190
190
  })
191
191
  });
192
192
  }
193
- F < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
+ F < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
194
194
  }
195
195
  }
196
196
  var le = L.ReactCurrentDispatcher, ue;
@@ -309,7 +309,7 @@ function wt() {
309
309
  return Qe(e.render);
310
310
  case m:
311
311
  return ee(e.type, t, n);
312
- case R: {
312
+ case C: {
313
313
  var d = e, y = d._payload, k = d._init;
314
314
  try {
315
315
  return ee(k(y), t, n);
@@ -342,7 +342,7 @@ function wt() {
342
342
  } catch (E) {
343
343
  p = E;
344
344
  }
345
- p && !(p instanceof Error) && (re(y), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", n, _, typeof p), re(null)), p instanceof Error && !(p.message in je) && (je[p.message] = !0, re(y), C("Failed %s type: %s", n, p.message), re(null));
345
+ p && !(p instanceof Error) && (re(y), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", n, _, typeof p), re(null)), p instanceof Error && !(p.message in je) && (je[p.message] = !0, re(y), R("Failed %s type: %s", n, p.message), re(null));
346
346
  }
347
347
  }
348
348
  }
@@ -368,7 +368,7 @@ function wt() {
368
368
  }
369
369
  function Pe(e) {
370
370
  if (nt(e))
371
- return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rt(e)), Se(e);
371
+ return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rt(e)), Se(e);
372
372
  }
373
373
  var q = L.ReactCurrentOwner, ot = {
374
374
  key: !0,
@@ -396,13 +396,13 @@ function wt() {
396
396
  function it(e, t) {
397
397
  if (typeof e.ref == "string" && q.current && t && q.current.stateNode !== t) {
398
398
  var n = A(q.current.type);
399
- ve[n] || (C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', A(q.current.type), e.ref), ve[n] = !0);
399
+ ve[n] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', A(q.current.type), e.ref), ve[n] = !0);
400
400
  }
401
401
  }
402
402
  function ct(e, t) {
403
403
  {
404
404
  var n = function() {
405
- Ae || (Ae = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
405
+ Ae || (Ae = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
406
406
  };
407
407
  n.isReactWarning = !0, Object.defineProperty(e, "key", {
408
408
  get: n,
@@ -413,7 +413,7 @@ function wt() {
413
413
  function lt(e, t) {
414
414
  {
415
415
  var n = function() {
416
- Fe || (Fe = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
416
+ Fe || (Fe = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
417
417
  };
418
418
  n.isReactWarning = !0, Object.defineProperty(e, "ref", {
419
419
  get: n,
@@ -527,7 +527,7 @@ Check the top-level render call using <` + n + ">.");
527
527
  return;
528
528
  De[n] = !0;
529
529
  var d = "";
530
- e && e._owner && e._owner !== he.current && (d = " It was passed a child from " + A(e._owner.type) + "."), V(e), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, d), V(null);
530
+ e && e._owner && e._owner !== he.current && (d = " It was passed a child from " + A(e._owner.type) + "."), V(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, d), V(null);
531
531
  }
532
532
  }
533
533
  function We(e, t) {
@@ -569,9 +569,9 @@ Check the top-level render call using <` + n + ">.");
569
569
  } else if (t.PropTypes !== void 0 && !pe) {
570
570
  pe = !0;
571
571
  var y = A(t);
572
- C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
572
+ R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
573
573
  }
574
- typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
574
+ typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
575
575
  }
576
576
  }
577
577
  function pt(e) {
@@ -579,11 +579,11 @@ Check the top-level render call using <` + n + ">.");
579
579
  for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
580
580
  var d = t[n];
581
581
  if (d !== "children" && d !== "key") {
582
- V(e), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), V(null);
582
+ V(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), V(null);
583
583
  break;
584
584
  }
585
585
  }
586
- e.ref !== null && (V(e), C("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
586
+ e.ref !== null && (V(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
587
587
  }
588
588
  }
589
589
  function Ue(e, t, n, d, y, k) {
@@ -595,7 +595,7 @@ Check the top-level render call using <` + n + ">.");
595
595
  var x = ft(y);
596
596
  x ? p += x : p += Ie();
597
597
  var E;
598
- e === null ? E = "null" : fe(e) ? E = "array" : e !== void 0 && e.$$typeof === s ? (E = "<" + (A(e.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, p);
598
+ e === null ? E = "null" : fe(e) ? E = "array" : e !== void 0 && e.$$typeof === s ? (E = "<" + (A(e.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, p);
599
599
  }
600
600
  var w = dt(e, t, n, y, k);
601
601
  if (w == null)
@@ -609,7 +609,7 @@ Check the top-level render call using <` + n + ">.");
609
609
  We(j[B], e);
610
610
  Object.freeze && Object.freeze(j);
611
611
  } else
612
- C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
+ R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
613
613
  else
614
614
  We(j, e);
615
615
  }
@@ -628,22 +628,22 @@ Check the top-level render call using <` + n + ">.");
628
628
  }
629
629
  process.env.NODE_ENV === "production" ? ye.exports = Tt() : ye.exports = wt();
630
630
  var i = ye.exports;
631
- const Be = "default", Rt = (o, s) => async (...r) => {
632
- var R;
631
+ const Be = "default", Ct = (o, s) => async (...r) => {
632
+ var C;
633
633
  const [a, u, ...l] = r, h = u ? { ...u } : { method: "GET" };
634
634
  let c = new Headers();
635
635
  h.headers && (c = h.headers instanceof Headers ? h.headers : new Headers(h.headers));
636
- const g = await s().getValidTokenAsync(), b = (R = g == null ? void 0 : g.tokens) == null ? void 0 : R.accessToken;
636
+ const g = await s().getValidTokenAsync(), b = (C = g == null ? void 0 : g.tokens) == null ? void 0 : C.accessToken;
637
637
  c.has("Accept") || c.set("Accept", "application/json"), b && (c.set("Authorization", `Bearer ${b}`), h.credentials || (h.credentials = "same-origin"));
638
638
  const m = { ...h, headers: c };
639
639
  return await o(a, m, ...l);
640
640
  }, Gt = (o = null, s = Be) => (r) => (a) => {
641
- const { fetch: u } = Ct(o || a.fetch, s);
641
+ const { fetch: u } = Rt(o || a.fetch, s);
642
642
  return /* @__PURE__ */ i.jsx(r, { ...a, fetch: u });
643
- }, Ct = (o = null, s = Be) => {
643
+ }, Rt = (o = null, s = Be) => {
644
644
  const r = o || window.fetch, a = f.get;
645
645
  return { fetch: kt(
646
- (l, h) => Rt(r, () => a(s))(l, h),
646
+ (l, h) => Ct(r, () => a(s))(l, h),
647
647
  [r, s]
648
648
  ) };
649
649
  }, qe = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
@@ -714,8 +714,8 @@ const Be = "default", Rt = (o, s) => async (...r) => {
714
714
  }) => {
715
715
  const v = window ? z(window.location.href) : "", [g, b] = P(v);
716
716
  O(() => {
717
- const R = () => b(z(window.location.href));
718
- return R(), window.addEventListener("popstate", R, !1), () => window.removeEventListener("popstate", R, !1);
717
+ const C = () => b(z(window.location.href));
718
+ return C(), window.addEventListener("popstate", C, !1), () => window.removeEventListener("popstate", C, !1);
719
719
  }, []);
720
720
  const m = z(r);
721
721
  if (a && g === z(a))
@@ -756,11 +756,11 @@ const Be = "default", Rt = (o, s) => async (...r) => {
756
756
  onSessionLost: g = null,
757
757
  onLogoutFromAnotherTab: b = null,
758
758
  onLogoutFromSameTab: m = null,
759
- withCustomHistory: R = null,
759
+ withCustomHistory: C = null,
760
760
  onEvent: D = null,
761
761
  getFetch: K = null
762
762
  }) => {
763
- const U = (S = "default") => f.getOrCreate(K ?? Et)(s, S), [ne, L] = P(!0), [C, $] = P(Ve), [oe, se] = P("default");
763
+ const U = (S = "default") => f.getOrCreate(K ?? Et)(s, S), [ne, L] = P(!0), [R, $] = P(Ve), [oe, se] = P("default");
764
764
  O(() => {
765
765
  const F = U(r).subscribeEvents((T, N) => {
766
766
  D && D(r, T, N);
@@ -790,7 +790,7 @@ const Be = "default", Rt = (o, s) => async (...r) => {
790
790
  };
791
791
  }, [s, r]);
792
792
  const ae = v, ie = u, W = l, X = h, ce = c, Y = ne || oe !== r, M = U(r);
793
- switch (C.name) {
793
+ switch (R.name) {
794
794
  case f.eventNames.service_worker_not_supported_by_browser:
795
795
  return /* @__PURE__ */ i.jsx(J, { loadingComponent: W, isLoading: Y, configurationName: r, children: /* @__PURE__ */ i.jsx(X, { configurationName: r }) });
796
796
  case f.eventNames.loginAsync_begin:
@@ -813,7 +813,7 @@ const Be = "default", Rt = (o, s) => async (...r) => {
813
813
  callbackErrorComponent: c,
814
814
  authenticatingComponent: u,
815
815
  configurationName: r,
816
- withCustomHistory: R,
816
+ withCustomHistory: C,
817
817
  children: /* @__PURE__ */ i.jsx($t, { loadingComponent: W, configurationName: r, children: o })
818
818
  }
819
819
  ) });
@@ -956,7 +956,7 @@ export {
956
956
  rr as TokenRenewMode,
957
957
  Kt as useOidc,
958
958
  Xt as useOidcAccessToken,
959
- Ct as useOidcFetch,
959
+ Rt as useOidcFetch,
960
960
  Qt as useOidcIdToken,
961
961
  Zt as useOidcUser,
962
962
  Gt as withOidcFetch,