@axa-fr/react-oidc 6.0.0-alpha9 → 6.0.0-beta10

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 (62) hide show
  1. package/README.md +20 -11
  2. package/dist/OidcProvider.d.ts +2 -3
  3. package/dist/OidcProvider.d.ts.map +1 -1
  4. package/dist/OidcProvider.js +5 -4
  5. package/dist/OidcProvider.js.map +1 -1
  6. package/dist/OidcServiceWorker.js +21 -4
  7. package/dist/OidcTrustedDomains.js +7 -2
  8. package/dist/core/default-component/SilentCallback.component.d.ts.map +1 -1
  9. package/dist/core/default-component/SilentCallback.component.js +5 -19
  10. package/dist/core/default-component/SilentCallback.component.js.map +1 -1
  11. package/dist/core/default-component/SilentLogin.component.d.ts +4 -0
  12. package/dist/core/default-component/SilentLogin.component.d.ts.map +1 -0
  13. package/dist/core/default-component/{SilentSignin.component.js → SilentLogin.component.js} +3 -3
  14. package/dist/core/default-component/SilentLogin.component.js.map +1 -0
  15. package/dist/core/routes/OidcRoutes.d.ts +1 -1
  16. package/dist/core/routes/OidcRoutes.d.ts.map +1 -1
  17. package/dist/core/routes/OidcRoutes.js +5 -8
  18. package/dist/core/routes/OidcRoutes.js.map +1 -1
  19. package/dist/vanilla/checkSessionIFrame.d.ts +6 -6
  20. package/dist/vanilla/checkSessionIFrame.d.ts.map +1 -1
  21. package/dist/vanilla/checkSessionIFrame.js +1 -1
  22. package/dist/vanilla/checkSessionIFrame.js.map +1 -1
  23. package/dist/vanilla/oidc.d.ts +12 -12
  24. package/dist/vanilla/oidc.d.ts.map +1 -1
  25. package/dist/vanilla/oidc.js +342 -236
  26. package/dist/vanilla/oidc.js.map +1 -1
  27. package/package.json +2 -2
  28. package/src/oidc/OidcProvider.tsx +9 -10
  29. package/src/oidc/core/default-component/SilentCallback.component.tsx +1 -6
  30. package/src/oidc/core/default-component/{SilentSignin.component.tsx → SilentLogin.component.tsx} +2 -2
  31. package/src/oidc/core/routes/OidcRoutes.tsx +6 -10
  32. package/src/oidc/vanilla/OidcServiceWorker.js +21 -4
  33. package/src/oidc/vanilla/OidcTrustedDomains.js +7 -2
  34. package/src/oidc/vanilla/checkSessionIFrame.ts +7 -7
  35. package/src/oidc/vanilla/oidc.ts +238 -195
  36. package/dist/core/default-component/ServiceWorkerInstall.component.d.ts +0 -4
  37. package/dist/core/default-component/ServiceWorkerInstall.component.d.ts.map +0 -1
  38. package/dist/core/default-component/ServiceWorkerInstall.component.js +0 -131
  39. package/dist/core/default-component/ServiceWorkerInstall.component.js.map +0 -1
  40. package/dist/core/default-component/SilentSignin.component.d.ts +0 -4
  41. package/dist/core/default-component/SilentSignin.component.d.ts.map +0 -1
  42. package/dist/core/default-component/SilentSignin.component.js.map +0 -1
  43. package/src/App.css +0 -38
  44. package/src/App.specold.tsx +0 -46
  45. package/src/App.tsx +0 -96
  46. package/src/FetchUser.tsx +0 -53
  47. package/src/Home.tsx +0 -22
  48. package/src/MultiAuth.tsx +0 -116
  49. package/src/Profile.tsx +0 -77
  50. package/src/configurations.ts +0 -70
  51. package/src/index.css +0 -13
  52. package/src/index.tsx +0 -9
  53. package/src/logo.svg +0 -7
  54. package/src/oidc/core/default-component/ServiceWorkerInstall.component.tsx +0 -60
  55. package/src/override/AuthenticateError.component.tsx +0 -14
  56. package/src/override/Authenticating.component.tsx +0 -14
  57. package/src/override/Callback.component.tsx +0 -13
  58. package/src/override/Loading.component.tsx +0 -13
  59. package/src/override/ServiceWorkerNotSupported.component.tsx +0 -15
  60. package/src/override/SessionLost.component.tsx +0 -21
  61. package/src/override/style.ts +0 -10
  62. package/src/setupTests.js +0 -5
@@ -1,70 +0,0 @@
1
- export const configurationIdentityServer = {
2
- client_id: 'interactive.public.short',
3
- redirect_uri: window.location.origin+'/authentication/callback',
4
- silent_redirect_uri: window.location.origin+'/authentication/silent-callback',
5
- silent_signin_uri: window.location.origin+'/authentication/silent-sign-in',
6
- scope: 'openid profile email api offline_access',
7
- authority: 'https://demo.duendesoftware.com',
8
- //authority_time_cache_wellknowurl_in_second: 60* 60,
9
- refresh_time_before_tokens_expiration_in_second: 280,
10
- service_worker_relative_url:'/OidcServiceWorker.js',
11
- service_worker_only: false,
12
- //storage: localStorage,
13
- //silent_signin_timeout: 3333000
14
- monitor_session:true,
15
- };
16
-
17
- export const configurationIdentityServerWithHash = {
18
- client_id: 'interactive.public.short',
19
- redirect_uri: window.location.origin+'/multi-auth/authentification#authentication-callback',
20
- silent_redirect_uri: window.location.origin+'/multi-auth/authentification#authentication-silent-callback',
21
- silent_signin_uri: window.location.origin+'#authentication-silent-signin',
22
- scope: 'openid profile email api offline_access',
23
- authority: 'https://demo.duendesoftware.com',
24
- refresh_time_before_tokens_expiration_in_second: 70,
25
- service_worker_relative_url:'/OidcServiceWorker.js',
26
- service_worker_only: false,
27
- };
28
-
29
- export const configurationIdentityServerWithoutDiscovery = {
30
- client_id: 'interactive.public.short',
31
- redirect_uri: window.location.origin+'/authentication/callback',
32
- silent_redirect_uri: window.location.origin+'/authentication/silent-callback',
33
- silent_signin_uri: window.location.origin+'/authentication/silent-sign-in',
34
- scope: 'openid profile email api offline_access',
35
- authority: 'https://demo.duendesoftware.com',
36
- authority_configuration: {
37
- authorization_endpoint: 'https://demo.duendesoftware.com/connect/authorize',
38
- token_endpoint: 'https://demo.duendesoftware.com/connect/token',
39
- userinfo_endpoint: 'https://demo.duendesoftware.com/connect/userinfo',
40
- end_session_endpoint: 'https://demo.duendesoftware.com/connect/endsession',
41
- revocation_endpoint: 'https://demo.duendesoftware.com/connect/revocation',
42
- },
43
- refresh_time_before_tokens_expiration_in_second: 70,
44
- service_worker_relative_url:'/OidcServiceWorker.js',
45
- service_worker_only: false,
46
- };
47
-
48
- export const configurationAuth0 = {
49
- client_id: 'xGZxEAJhzlkuQUlWl90y1ntIX-0UDWHx',
50
- redirect_uri: window.location.origin+'/callback',
51
- scope: 'openid profile email api offline_access',
52
- authority: 'https://kdhttps.auth0.com',
53
- refresh_time_before_tokens_expiration_in_second: 70,
54
- service_worker_relative_url:'/OidcServiceWorker.js',
55
- service_worker_only: false,
56
- };
57
-
58
- export const configurationGoogle = {
59
- client_id: '908893276222-f2drloh56ll0g99md38lv2k810d0nk0p.apps.googleusercontent.com',
60
- redirect_uri: `${window.location.origin}/multi-auth/callback-google`,
61
- silent_redirect_uri: window.location.origin+'/multi-auth/silent-callback-google',
62
- silent_signin_uri: window.location.origin+'/multi-auth/silent-signin-google',
63
- scope: 'openid profile email',
64
- authority: 'https://accounts.google.com/',
65
- service_worker_relative_url:'/OidcServiceWorker.js',
66
- service_worker_only: false,
67
- token_request_extras: {
68
- client_secret : "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"
69
- }
70
- };
package/src/index.css DELETED
@@ -1,13 +0,0 @@
1
- body {
2
- margin: 0;
3
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
- sans-serif;
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
9
-
10
- code {
11
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
- monospace;
13
- }
package/src/index.tsx DELETED
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { createRoot } from 'react-dom/client';
3
- import './index.css';
4
- import App from './App';
5
- import 'bootstrap/dist/css/bootstrap.min.css';
6
-
7
- const container = document.getElementById('root');
8
- const root = createRoot(container); // createRoot(container!) if you use TypeScript
9
- root.render(<React.StrictMode><App/></React.StrictMode>);
package/src/logo.svg DELETED
@@ -1,7 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
2
- <g fill="#61DAFB">
3
- <path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
4
- <circle cx="420.9" cy="296.5" r="45.7"/>
5
- <path d="M520.5 78.1z"/>
6
- </g>
7
- </svg>
@@ -1,60 +0,0 @@
1
- import React, {useEffect, useState, ComponentType} from 'react';
2
- import AuthenticatingError from "./AuthenticateError.component";
3
- import Oidc from "../../vanilla/oidc";
4
- import Authenticating from "./Authenticating.component";
5
- import {getParseQueryStringFromLocation} from "../../vanilla/route-utils";
6
-
7
- const ServiceWorkerInstall: ComponentType<any> = ({callBackError, authenticating, configurationName }) => {
8
- const getOidc = Oidc.get;
9
- const [error, setError] = useState(false);
10
- const [isLoading, setLoading] = useState(true);
11
-
12
- const CallbackErrorComponent = callBackError || AuthenticatingError;
13
- const CallbackSuccessComponent = authenticating || Authenticating;
14
-
15
- useEffect(() => {
16
- let isMounted = true;
17
- const playCallbackAsync = async () => {
18
- try {
19
- const queryParams = getParseQueryStringFromLocation(window.location.href);
20
- let extras = null;
21
- for (let [key, value] of Object.entries(queryParams)) {
22
- if(key === "state" || key == "callbackPath"){
23
- continue;
24
- }
25
- if(extras === null){
26
- extras = {};
27
- }
28
- extras[key] = value;
29
- }
30
-
31
- // @ts-ignore
32
- await getOidc(configurationName).loginAsync(queryParams.callbackPath, extras,false, queryParams.state);
33
- if(isMounted) {
34
- setLoading(false);
35
- }
36
- } catch (error) {
37
- if(isMounted) {
38
- setError(true);
39
- setLoading(false);
40
- }
41
- }
42
- };
43
- playCallbackAsync();
44
- return () => {
45
- isMounted = false;
46
- };
47
- },[]);
48
-
49
- if(isLoading){
50
- return null;
51
- }
52
-
53
- if(error){
54
- return <CallbackErrorComponent configurationName={configurationName} />
55
- }
56
-
57
- return <CallbackSuccessComponent configurationName={configurationName} />;
58
- };
59
-
60
- export default ServiceWorkerInstall;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import {ComponentType} from "react";
3
- import {style} from "./style";
4
-
5
- const AuthenticatingError: ComponentType<any> = ({configurationName}) => (
6
- <div className="oidc-authenticating" style={style}>
7
- <div className="oidc-authenticating__container">
8
- <h1 className="oidc-authenticating__title">Error authentication for {configurationName}</h1>
9
- <p className="oidc-authenticating__content">An error occurred during authentication.</p>
10
- </div>
11
- </div>
12
- );
13
-
14
- export default AuthenticatingError;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import {PropsWithChildren} from "react";
3
- import {style} from "./style";
4
-
5
- const Authenticating : PropsWithChildren<any> = ({configurationName}) => (
6
- <div className="oidc-authenticating" style={style}>
7
- <div className="oidc-authenticating__container">
8
- <h1 className="oidc-authenticating__title">Authentication in progress for {configurationName}</h1>
9
- <p className="oidc-authenticating__content">You will be redirected to the login page.</p>
10
- </div>
11
- </div>
12
- );
13
-
14
- export default Authenticating;
@@ -1,13 +0,0 @@
1
- import React, {ComponentType} from 'react';
2
- import {style} from "./style";
3
-
4
- export const CallBackSuccess: ComponentType<any> = ({configurationName}) => (<><div className="oidc-callback" style={style}>
5
- <div className="oidc-callback__container">
6
- <h1 className="oidc-callback__title">Authentication complete for {configurationName}</h1>
7
- <p className="oidc-callback__content">You will be redirected to your application.</p>
8
- </div>
9
- </div>
10
- <div>
11
- </div>
12
- </>
13
- );
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- import {ComponentType } from "react";
3
- import {style} from "./style";
4
-
5
- const Loading : ComponentType<any> = ({children, configurationName}) => (
6
- <>
7
- <span className="oidc-loading" style={style}>
8
- Loading for {configurationName}
9
- </span>
10
- </>
11
- );
12
-
13
- export default Loading;
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import {ComponentType} from "react";
3
- import {style} from "./style";
4
-
5
- const ServiceWorkerNotSupported : ComponentType<any> = ({configurationName}) => (
6
- <><div className="oidc-serviceworker" style={style}>
7
- <div className="oidc-serviceworker__container">
8
- <h1 className="oidc-serviceworker__title">Unable to authenticate on this browser for {configurationName}</h1>
9
- <p className="oidc-serviceworker__content">Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser.</p>
10
- </div>
11
- </div>
12
- </>
13
- );
14
-
15
- export default ServiceWorkerNotSupported;
@@ -1,21 +0,0 @@
1
- import React, {ComponentType} from 'react';
2
- import {style} from "./style"
3
- import {useOidc} from "../oidc";
4
-
5
- export const SessionLost: ComponentType<any> = ({configurationName}) => {
6
- const { login} = useOidc(configurationName);
7
-
8
- return (<>
9
- <div className="oidc-session-lost" style={style}>
10
- <div className="oidc-session-lost__container">
11
- <h1 className="oidc-session-lost__title">Session timed out for {configurationName}</h1>
12
- <p className="oidc-session-lost__content">
13
- Your session has expired. Please re-authenticate.
14
- </p>
15
- <button type="button" className="btn btn-primary" onClick={() => login(null)}>Login</button>
16
- </div>
17
- </div>
18
- </>)
19
- };
20
-
21
- export default SessionLost;
@@ -1,10 +0,0 @@
1
- export const style = {
2
- "color": "rgb(53,110,255)",
3
- "backgroundColor": "rgb(255 255 255 / 88%)",
4
- "position": "absolute",
5
- "zIndex": 1000,
6
- "top": "0px",
7
- "bottom": "0px",
8
- "right": "0px",
9
- "left": "0px",
10
- };
package/src/setupTests.js DELETED
@@ -1,5 +0,0 @@
1
- // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
- // allows you to do things like:
3
- // expect(element).toHaveTextContent(/react/i)
4
- // learn more: https://github.com/testing-library/jest-dom
5
- import '@testing-library/jest-dom/extend-expect';