@axa-fr/react-oidc 6.24.27-beta929 → 6.25.0-alpha939
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/bin/post-install.js +35 -0
- package/dist/FetchToken.d.ts +2 -3
- package/dist/FetchToken.d.ts.map +1 -1
- package/dist/OidcProvider.d.ts +4 -5
- package/dist/OidcProvider.d.ts.map +1 -1
- package/dist/OidcSecure.d.ts +3 -3
- package/dist/OidcSecure.d.ts.map +1 -1
- package/dist/OidcServiceWorker.js +559 -0
- package/{service_worker → dist}/OidcTrustedDomains.js +4 -5
- package/dist/ReactOidc.d.ts +4 -4
- package/dist/ReactOidc.d.ts.map +1 -1
- package/dist/User.d.ts +2 -2
- package/dist/User.d.ts.map +1 -1
- package/dist/core/default-component/AuthenticateError.component.d.ts.map +1 -1
- package/dist/core/default-component/Authenticating.component.d.ts.map +1 -1
- package/dist/core/default-component/Callback.component.d.ts.map +1 -1
- package/dist/core/default-component/Loading.component.d.ts.map +1 -1
- package/dist/core/default-component/ServiceWorkerNotSupported.component.d.ts.map +1 -1
- package/dist/core/default-component/SessionLost.component.d.ts.map +1 -1
- package/dist/core/default-component/SilentCallback.component.d.ts.map +1 -1
- package/dist/core/default-component/SilentLogin.component.d.ts.map +1 -1
- package/dist/core/default-component/index.d.ts.map +1 -1
- package/dist/core/routes/OidcRoutes.d.ts +1 -1
- package/dist/core/routes/OidcRoutes.d.ts.map +1 -1
- package/dist/core/routes/index.d.ts +3 -0
- package/dist/core/routes/index.d.ts.map +1 -0
- package/dist/core/routes/withRouter.d.ts +4 -4
- package/dist/core/routes/withRouter.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +964 -21
- package/dist/index.umd.cjs +27 -0
- package/package.json +37 -43
- package/src/{oidc/FetchToken.tsx → FetchToken.tsx} +14 -16
- package/src/{oidc/OidcProvider.tsx → OidcProvider.tsx} +40 -42
- package/src/{oidc/OidcSecure.tsx → OidcSecure.tsx} +1 -3
- package/src/{oidc/ReactOidc.tsx → ReactOidc.tsx} +1 -3
- package/src/{oidc/User.ts → User.ts} +1 -2
- package/src/{oidc/core → core}/default-component/AuthenticateError.component.tsx +0 -1
- package/src/{oidc/core → core}/default-component/Authenticating.component.tsx +0 -1
- package/src/{oidc/core → core}/default-component/Callback.component.tsx +2 -2
- package/src/{oidc/core → core}/default-component/Loading.component.tsx +0 -1
- package/src/{oidc/core → core}/default-component/ServiceWorkerNotSupported.component.tsx +0 -1
- package/src/{oidc/core → core}/default-component/SessionLost.component.tsx +1 -1
- package/src/{oidc/core → core}/default-component/SilentCallback.component.tsx +1 -2
- package/src/{oidc/core → core}/default-component/SilentLogin.component.tsx +1 -3
- package/src/{oidc/core → core}/routes/OidcRoutes.spec.tsx +3 -2
- package/src/{oidc/core → core}/routes/OidcRoutes.tsx +6 -6
- package/src/{oidc/core → core}/routes/withRouter.spec.tsx +3 -5
- package/src/{oidc/index.ts → index.ts} +7 -2
- package/bin/copy.cjs +0 -43
- package/dist/FetchToken.js +0 -59
- package/dist/FetchToken.js.map +0 -1
- package/dist/OidcProvider.js +0 -134
- package/dist/OidcProvider.js.map +0 -1
- package/dist/OidcSecure.js +0 -25
- package/dist/OidcSecure.js.map +0 -1
- package/dist/ReactOidc.js +0 -156
- package/dist/ReactOidc.js.map +0 -1
- package/dist/User.js +0 -42
- package/dist/User.js.map +0 -1
- package/dist/core/default-component/AuthenticateError.component.js +0 -6
- package/dist/core/default-component/AuthenticateError.component.js.map +0 -1
- package/dist/core/default-component/Authenticating.component.js +0 -6
- package/dist/core/default-component/Authenticating.component.js.map +0 -1
- package/dist/core/default-component/Callback.component.js +0 -54
- package/dist/core/default-component/Callback.component.js.map +0 -1
- package/dist/core/default-component/Loading.component.js +0 -6
- package/dist/core/default-component/Loading.component.js.map +0 -1
- package/dist/core/default-component/ServiceWorkerNotSupported.component.js +0 -6
- package/dist/core/default-component/ServiceWorkerNotSupported.component.js.map +0 -1
- package/dist/core/default-component/SessionLost.component.js +0 -8
- package/dist/core/default-component/SessionLost.component.js.map +0 -1
- package/dist/core/default-component/SilentCallback.component.js +0 -27
- package/dist/core/default-component/SilentCallback.component.js.map +0 -1
- package/dist/core/default-component/SilentLogin.component.js +0 -29
- package/dist/core/default-component/SilentLogin.component.js.map +0 -1
- package/dist/core/default-component/index.js +0 -20
- package/dist/core/default-component/index.js.map +0 -1
- package/dist/core/routes/OidcRoutes.js +0 -64
- package/dist/core/routes/OidcRoutes.js.map +0 -1
- package/dist/core/routes/withRouter.js +0 -31
- package/dist/core/routes/withRouter.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/service_worker/OidcServiceWorker.d.ts +0 -2
- package/dist/service_worker/OidcServiceWorker.d.ts.map +0 -1
- package/dist/service_worker/OidcServiceWorker.js +0 -2
- package/dist/service_worker/OidcServiceWorker.js.map +0 -1
- package/dist/service_worker/constants.d.ts +0 -18
- package/dist/service_worker/constants.d.ts.map +0 -1
- package/dist/service_worker/types.d.ts +0 -87
- package/dist/service_worker/types.d.ts.map +0 -1
- package/dist/service_worker/utils/codeVerifier.d.ts +0 -2
- package/dist/service_worker/utils/codeVerifier.d.ts.map +0 -1
- package/dist/service_worker/utils/domains.d.ts +0 -7
- package/dist/service_worker/utils/domains.d.ts.map +0 -1
- package/dist/service_worker/utils/index.d.ts +0 -6
- package/dist/service_worker/utils/index.d.ts.map +0 -1
- package/dist/service_worker/utils/serializeHeaders.d.ts +0 -3
- package/dist/service_worker/utils/serializeHeaders.d.ts.map +0 -1
- package/dist/service_worker/utils/sleep.d.ts +0 -3
- package/dist/service_worker/utils/sleep.d.ts.map +0 -1
- package/dist/service_worker/utils/strings.d.ts +0 -8
- package/dist/service_worker/utils/strings.d.ts.map +0 -1
- package/dist/service_worker/utils/tokens.d.ts +0 -22
- package/dist/service_worker/utils/tokens.d.ts.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vanilla/cache.d.ts +0 -3
- package/dist/vanilla/cache.d.ts.map +0 -1
- package/dist/vanilla/cache.js +0 -30
- package/dist/vanilla/cache.js.map +0 -1
- package/dist/vanilla/checkSession.d.ts +0 -4
- package/dist/vanilla/checkSession.d.ts.map +0 -1
- package/dist/vanilla/checkSession.js +0 -73
- package/dist/vanilla/checkSession.js.map +0 -1
- package/dist/vanilla/checkSessionIFrame.d.ts +0 -17
- package/dist/vanilla/checkSessionIFrame.d.ts.map +0 -1
- package/dist/vanilla/checkSessionIFrame.js +0 -73
- package/dist/vanilla/checkSessionIFrame.js.map +0 -1
- package/dist/vanilla/crypto.d.ts +0 -4
- package/dist/vanilla/crypto.d.ts.map +0 -1
- package/dist/vanilla/crypto.js +0 -85
- package/dist/vanilla/crypto.js.map +0 -1
- package/dist/vanilla/events.d.ts +0 -29
- package/dist/vanilla/events.d.ts.map +0 -1
- package/dist/vanilla/events.js +0 -32
- package/dist/vanilla/events.js.map +0 -1
- package/dist/vanilla/index.d.ts +0 -3
- package/dist/vanilla/index.d.ts.map +0 -1
- package/dist/vanilla/index.js +0 -6
- package/dist/vanilla/index.js.map +0 -1
- package/dist/vanilla/initSession.d.ts +0 -22
- package/dist/vanilla/initSession.d.ts.map +0 -1
- package/dist/vanilla/initSession.js +0 -90
- package/dist/vanilla/initSession.js.map +0 -1
- package/dist/vanilla/initWorker.d.ts +0 -30
- package/dist/vanilla/initWorker.d.ts.map +0 -1
- package/dist/vanilla/initWorker.js +0 -317
- package/dist/vanilla/initWorker.js.map +0 -1
- package/dist/vanilla/login.d.ts +0 -8
- package/dist/vanilla/login.d.ts.map +0 -1
- package/dist/vanilla/login.js +0 -175
- package/dist/vanilla/login.js.map +0 -1
- package/dist/vanilla/logout.d.ts +0 -8
- package/dist/vanilla/logout.d.ts.map +0 -1
- package/dist/vanilla/logout.js +0 -118
- package/dist/vanilla/logout.js.map +0 -1
- package/dist/vanilla/oidc.d.ts +0 -101
- package/dist/vanilla/oidc.d.ts.map +0 -1
- package/dist/vanilla/oidc.js +0 -612
- package/dist/vanilla/oidc.js.map +0 -1
- package/dist/vanilla/parseTokens.d.ts +0 -37
- package/dist/vanilla/parseTokens.d.ts.map +0 -1
- package/dist/vanilla/parseTokens.js +0 -167
- package/dist/vanilla/parseTokens.js.map +0 -1
- package/dist/vanilla/renewTokens.d.ts +0 -4
- package/dist/vanilla/renewTokens.d.ts.map +0 -1
- package/dist/vanilla/renewTokens.js +0 -51
- package/dist/vanilla/renewTokens.js.map +0 -1
- package/dist/vanilla/requests.d.ts +0 -33
- package/dist/vanilla/requests.d.ts.map +0 -1
- package/dist/vanilla/requests.js +0 -174
- package/dist/vanilla/requests.js.map +0 -1
- package/dist/vanilla/route-utils.d.ts +0 -13
- package/dist/vanilla/route-utils.d.ts.map +0 -1
- package/dist/vanilla/route-utils.js +0 -71
- package/dist/vanilla/route-utils.js.map +0 -1
- package/dist/vanilla/silentLogin.d.ts +0 -10
- package/dist/vanilla/silentLogin.d.ts.map +0 -1
- package/dist/vanilla/silentLogin.js +0 -144
- package/dist/vanilla/silentLogin.js.map +0 -1
- package/dist/vanilla/timer.d.ts +0 -8
- package/dist/vanilla/timer.d.ts.map +0 -1
- package/dist/vanilla/timer.js +0 -143
- package/dist/vanilla/timer.js.map +0 -1
- package/dist/vanilla/types.d.ts +0 -38
- package/dist/vanilla/types.d.ts.map +0 -1
- package/dist/vanilla/types.js +0 -3
- package/dist/vanilla/types.js.map +0 -1
- package/dist/vanilla/user.d.ts +0 -2
- package/dist/vanilla/user.d.ts.map +0 -1
- package/dist/vanilla/user.js +0 -48
- package/dist/vanilla/user.js.map +0 -1
- package/dist/vanilla/vanillaOidc.d.ts +0 -85
- package/dist/vanilla/vanillaOidc.d.ts.map +0 -1
- package/dist/vanilla/vanillaOidc.js +0 -71
- package/dist/vanilla/vanillaOidc.js.map +0 -1
- package/service_worker/.eslintrc.cjs +0 -18
- package/service_worker/OidcServiceWorker.ts +0 -424
- package/service_worker/constants.ts +0 -32
- package/service_worker/dist/OidcServiceWorker.d.ts +0 -2
- package/service_worker/dist/OidcServiceWorker.d.ts.map +0 -1
- package/service_worker/dist/OidcServiceWorker.js +0 -2
- package/service_worker/dist/OidcServiceWorker.js.map +0 -1
- package/service_worker/dist/constants.d.ts +0 -18
- package/service_worker/dist/constants.d.ts.map +0 -1
- package/service_worker/dist/types.d.ts +0 -87
- package/service_worker/dist/types.d.ts.map +0 -1
- package/service_worker/dist/utils/codeVerifier.d.ts +0 -2
- package/service_worker/dist/utils/codeVerifier.d.ts.map +0 -1
- package/service_worker/dist/utils/domains.d.ts +0 -7
- package/service_worker/dist/utils/domains.d.ts.map +0 -1
- package/service_worker/dist/utils/index.d.ts +0 -6
- package/service_worker/dist/utils/index.d.ts.map +0 -1
- package/service_worker/dist/utils/serializeHeaders.d.ts +0 -3
- package/service_worker/dist/utils/serializeHeaders.d.ts.map +0 -1
- package/service_worker/dist/utils/sleep.d.ts +0 -3
- package/service_worker/dist/utils/sleep.d.ts.map +0 -1
- package/service_worker/dist/utils/strings.d.ts +0 -8
- package/service_worker/dist/utils/strings.d.ts.map +0 -1
- package/service_worker/dist/utils/tokens.d.ts +0 -22
- package/service_worker/dist/utils/tokens.d.ts.map +0 -1
- package/service_worker/tsconfig.json +0 -26
- package/service_worker/types.ts +0 -103
- package/service_worker/utils/__tests__/codeVerifier.spec.ts +0 -14
- package/service_worker/utils/__tests__/domains.spec.ts +0 -90
- package/service_worker/utils/__tests__/serializeHeaders.spec.ts +0 -11
- package/service_worker/utils/__tests__/strings.spec.ts +0 -9
- package/service_worker/utils/__tests__/testHelper.ts +0 -352
- package/service_worker/utils/__tests__/tokens.spec.ts +0 -92
- package/service_worker/utils/codeVerifier.ts +0 -6
- package/service_worker/utils/domains.ts +0 -105
- package/service_worker/utils/index.ts +0 -5
- package/service_worker/utils/serializeHeaders.ts +0 -12
- package/service_worker/utils/sleep.ts +0 -2
- package/service_worker/utils/strings.ts +0 -9
- package/service_worker/utils/tokens.ts +0 -206
- package/src/oidc/vanilla/cache.ts +0 -27
- package/src/oidc/vanilla/checkSession.ts +0 -60
- package/src/oidc/vanilla/checkSessionIFrame.ts +0 -83
- package/src/oidc/vanilla/crypto.ts +0 -61
- package/src/oidc/vanilla/events.ts +0 -29
- package/src/oidc/vanilla/index.ts +0 -2
- package/src/oidc/vanilla/iniWorker.spec.ts +0 -21
- package/src/oidc/vanilla/initSession.ts +0 -90
- package/src/oidc/vanilla/initWorker.ts +0 -321
- package/src/oidc/vanilla/login.ts +0 -174
- package/src/oidc/vanilla/logout.spec.ts +0 -66
- package/src/oidc/vanilla/logout.spec.tsx +0 -64
- package/src/oidc/vanilla/logout.ts +0 -101
- package/src/oidc/vanilla/oidc.ts +0 -614
- package/src/oidc/vanilla/parseTokens.spec.ts +0 -49
- package/src/oidc/vanilla/parseTokens.ts +0 -194
- package/src/oidc/vanilla/renewTokens.ts +0 -37
- package/src/oidc/vanilla/requests.spec.ts +0 -9
- package/src/oidc/vanilla/requests.ts +0 -169
- package/src/oidc/vanilla/route-utils.spec.ts +0 -23
- package/src/oidc/vanilla/route-utils.ts +0 -79
- package/src/oidc/vanilla/silentLogin.ts +0 -144
- package/src/oidc/vanilla/timer.ts +0 -163
- package/src/oidc/vanilla/types.ts +0 -42
- package/src/oidc/vanilla/user.ts +0 -40
- package/src/oidc/vanilla/vanillaOidc.ts +0 -109
- package/src/override/AuthenticateError.component.tsx +0 -15
- package/src/override/Authenticating.component.tsx +0 -15
- package/src/override/Callback.component.tsx +0 -14
- package/src/override/Loading.component.tsx +0 -11
- package/src/override/ServiceWorkerNotSupported.component.tsx +0 -15
- package/src/override/SessionLost.component.tsx +0 -22
- package/src/override/style.ts +0 -12
- /package/src/{oidc/core → core}/default-component/index.ts +0 -0
- /package/src/{oidc/core → core}/routes/__snapshots__/OidcRoutes.spec.tsx.snap +0 -0
- /package/src/{oidc/core → core}/routes/index.ts +0 -0
- /package/src/{oidc/core → core}/routes/withRouter.tsx +0 -0
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
const timer = (function () {
|
|
2
|
-
const workerPort = (function () {
|
|
3
|
-
let worker;
|
|
4
|
-
let blobURL;
|
|
5
|
-
|
|
6
|
-
const workerCode = function () {
|
|
7
|
-
const innerIdsByOuterIds = {};
|
|
8
|
-
|
|
9
|
-
const methods = {
|
|
10
|
-
setTimeout: function (port, id, timeout) {
|
|
11
|
-
innerIdsByOuterIds[id] = setTimeout(function () {
|
|
12
|
-
port.postMessage(id);
|
|
13
|
-
innerIdsByOuterIds[id] = null;
|
|
14
|
-
}, timeout);
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
setInterval: function (port, id, timeout) {
|
|
18
|
-
innerIdsByOuterIds[id] = setInterval(function () {
|
|
19
|
-
port.postMessage(id);
|
|
20
|
-
}, timeout);
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
clearTimeout: function (port, id) {
|
|
24
|
-
clearTimeout(innerIdsByOuterIds[id]);
|
|
25
|
-
innerIdsByOuterIds[id] = null;
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
clearInterval: function (port, id) {
|
|
29
|
-
clearInterval(innerIdsByOuterIds[id]);
|
|
30
|
-
innerIdsByOuterIds[id] = null;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function onMessage(port, event) {
|
|
35
|
-
const method = event.data[0];
|
|
36
|
-
const id = event.data[1];
|
|
37
|
-
const option = event.data[2];
|
|
38
|
-
|
|
39
|
-
if (methods[method]) {
|
|
40
|
-
methods[method](port, id, option);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// For Dedicated Worker
|
|
45
|
-
this.onmessage = function (event) {
|
|
46
|
-
onMessage(self, event);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// For Shared Worker
|
|
50
|
-
this.onconnect = function (event) {
|
|
51
|
-
const port = event.ports[0];
|
|
52
|
-
|
|
53
|
-
port.onmessage = function (event) {
|
|
54
|
-
onMessage(port, event);
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
}.toString();
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
const blob = new Blob(['(', workerCode, ')()'], { type: 'application/javascript' });
|
|
61
|
-
blobURL = URL.createObjectURL(blob);
|
|
62
|
-
} catch (error) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
const isInsideBrowser = (typeof process === 'undefined');
|
|
66
|
-
try {
|
|
67
|
-
if (SharedWorker) {
|
|
68
|
-
worker = new SharedWorker(blobURL);
|
|
69
|
-
return worker.port;
|
|
70
|
-
}
|
|
71
|
-
} catch (error) {
|
|
72
|
-
if (isInsideBrowser) {
|
|
73
|
-
console.warn('SharedWorker not available');
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
if (Worker) {
|
|
78
|
-
worker = new Worker(blobURL);
|
|
79
|
-
return worker;
|
|
80
|
-
}
|
|
81
|
-
} catch (error) {
|
|
82
|
-
if (isInsideBrowser) {
|
|
83
|
-
console.warn('Worker not available');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return null;
|
|
88
|
-
}());
|
|
89
|
-
|
|
90
|
-
if (!workerPort) {
|
|
91
|
-
// In NextJS with SSR (Server Side Rendering) during rending in Node JS, the window object is undefined,
|
|
92
|
-
// the global object is used instead as it is the closest approximation of a browsers window object.
|
|
93
|
-
const bindContext = (typeof window === 'undefined') ? global : window;
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
setTimeout: setTimeout.bind(bindContext),
|
|
97
|
-
clearTimeout: clearTimeout.bind(bindContext),
|
|
98
|
-
setInterval: setInterval.bind(bindContext),
|
|
99
|
-
clearInterval: clearInterval.bind(bindContext),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const getId = (function () {
|
|
104
|
-
let currentId = 0;
|
|
105
|
-
|
|
106
|
-
return function () {
|
|
107
|
-
currentId++;
|
|
108
|
-
return currentId;
|
|
109
|
-
};
|
|
110
|
-
}());
|
|
111
|
-
|
|
112
|
-
const timeoutCallbacksById = {};
|
|
113
|
-
const intervalCallbacksById = {};
|
|
114
|
-
|
|
115
|
-
workerPort.onmessage = function (event) {
|
|
116
|
-
const id = event.data;
|
|
117
|
-
|
|
118
|
-
const timeoutCallback = timeoutCallbacksById[id];
|
|
119
|
-
if (timeoutCallback) {
|
|
120
|
-
timeoutCallback();
|
|
121
|
-
timeoutCallbacksById[id] = null;
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const intervalCallback = intervalCallbacksById[id];
|
|
126
|
-
if (intervalCallback) {
|
|
127
|
-
intervalCallback();
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
function setTimeoutWorker(callback, timeout) {
|
|
132
|
-
const id = getId();
|
|
133
|
-
workerPort.postMessage(['setTimeout', id, timeout]);
|
|
134
|
-
timeoutCallbacksById[id] = callback;
|
|
135
|
-
return id;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function clearTimeoutWorker(id) {
|
|
139
|
-
workerPort.postMessage(['clearTimeout', id]);
|
|
140
|
-
timeoutCallbacksById[id] = null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function setIntervalWorker(callback, timeout) {
|
|
144
|
-
const id = getId();
|
|
145
|
-
workerPort.postMessage(['setInterval', id, timeout]);
|
|
146
|
-
intervalCallbacksById[id] = callback;
|
|
147
|
-
return id;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function clearIntervalWorker(id) {
|
|
151
|
-
workerPort.postMessage(['clearInterval', id]);
|
|
152
|
-
intervalCallbacksById[id] = null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
setTimeout: setTimeoutWorker,
|
|
157
|
-
clearTimeout: clearTimeoutWorker,
|
|
158
|
-
setInterval: setIntervalWorker,
|
|
159
|
-
clearInterval: clearIntervalWorker,
|
|
160
|
-
};
|
|
161
|
-
}());
|
|
162
|
-
|
|
163
|
-
export default timer;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type Fetch = typeof window.fetch;
|
|
3
|
-
|
|
4
|
-
export type LogoutToken = 'access_token' | 'refresh_token';
|
|
5
|
-
|
|
6
|
-
export type OidcConfiguration = {
|
|
7
|
-
client_id: string;
|
|
8
|
-
redirect_uri: string;
|
|
9
|
-
silent_redirect_uri?:string;
|
|
10
|
-
silent_login_uri?:string;
|
|
11
|
-
silent_login_timeout?:number;
|
|
12
|
-
scope: string;
|
|
13
|
-
authority: string;
|
|
14
|
-
authority_time_cache_wellknowurl_in_second?: number;
|
|
15
|
-
authority_timeout_wellknowurl_in_millisecond?: number;
|
|
16
|
-
authority_configuration?: AuthorityConfiguration;
|
|
17
|
-
refresh_time_before_tokens_expiration_in_second?: number;
|
|
18
|
-
token_request_timeout?: number;
|
|
19
|
-
service_worker_relative_url?:string;
|
|
20
|
-
service_worker_only?:boolean;
|
|
21
|
-
service_worker_convert_all_requests_to_cors?:boolean;
|
|
22
|
-
extras?:StringMap;
|
|
23
|
-
token_request_extras?:StringMap;
|
|
24
|
-
storage?: Storage;
|
|
25
|
-
monitor_session?: boolean;
|
|
26
|
-
token_renew_mode?: string;
|
|
27
|
-
logout_tokens_to_invalidate?:Array<LogoutToken>;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export interface StringMap {
|
|
31
|
-
[key: string]: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface AuthorityConfiguration {
|
|
35
|
-
authorization_endpoint: string;
|
|
36
|
-
token_endpoint: string;
|
|
37
|
-
revocation_endpoint: string;
|
|
38
|
-
end_session_endpoint?: string;
|
|
39
|
-
userinfo_endpoint?: string;
|
|
40
|
-
check_session_iframe?:string;
|
|
41
|
-
issuer:string;
|
|
42
|
-
}
|
package/src/oidc/vanilla/user.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { sleepAsync } from './initWorker.js';
|
|
2
|
-
import { isTokensValid } from './parseTokens.js';
|
|
3
|
-
|
|
4
|
-
export const userInfoAsync = (oidc) => async (noCache = false) => {
|
|
5
|
-
if (oidc.userInfo != null && !noCache) {
|
|
6
|
-
return oidc.userInfo;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// We wait the synchronisation before making a request
|
|
10
|
-
while (oidc.tokens && !isTokensValid(oidc.tokens)) {
|
|
11
|
-
await sleepAsync(200);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (!oidc.tokens) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const accessToken = oidc.tokens.accessToken;
|
|
18
|
-
if (!accessToken) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const oidcServerConfiguration = await oidc.initAsync(oidc.configuration.authority, oidc.configuration.authority_configuration);
|
|
23
|
-
const url = oidcServerConfiguration.userInfoEndpoint;
|
|
24
|
-
const fetchUserInfo = async (accessToken) => {
|
|
25
|
-
const res = await fetch(url, {
|
|
26
|
-
headers: {
|
|
27
|
-
authorization: `Bearer ${accessToken}`,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (res.status !== 200) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return res.json();
|
|
36
|
-
};
|
|
37
|
-
const userInfo = await fetchUserInfo(accessToken);
|
|
38
|
-
oidc.userInfo = userInfo;
|
|
39
|
-
return userInfo;
|
|
40
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { LoginCallback, Oidc } from './oidc.js';
|
|
3
|
-
import { getValidTokenAsync, Tokens, ValidToken } from './parseTokens.js';
|
|
4
|
-
import { Fetch, OidcConfiguration, StringMap } from './types.js';
|
|
5
|
-
|
|
6
|
-
export interface EventSubscriber {
|
|
7
|
-
(name: string, data:any);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class VanillaOidc {
|
|
11
|
-
private _oidc: Oidc;
|
|
12
|
-
constructor(oidc: Oidc) {
|
|
13
|
-
this._oidc = oidc;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
subscribeEvents(func:EventSubscriber):string {
|
|
17
|
-
return this._oidc.subscribeEvents(func);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
removeEventSubscription(id:string):void {
|
|
21
|
-
this._oidc.removeEventSubscription(id);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
publishEvent(eventName:string, data:any) : void {
|
|
25
|
-
this._oidc.publishEvent(eventName, data);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static getOrCreate = (getFetch : () => Fetch) => (configuration:OidcConfiguration, name = 'default'): VanillaOidc => {
|
|
29
|
-
return new VanillaOidc(Oidc.getOrCreate(getFetch)(configuration, name));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
static get(name = 'default'):VanillaOidc {
|
|
33
|
-
return new VanillaOidc(Oidc.get(name));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static eventNames = Oidc.eventNames;
|
|
37
|
-
tryKeepExistingSessionAsync():Promise<boolean> {
|
|
38
|
-
return this._oidc.tryKeepExistingSessionAsync();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
loginAsync(callbackPath:string = undefined, extras:StringMap = null, isSilentSignin = false, scope:string = undefined, silentLoginOnly = false):Promise<void> {
|
|
42
|
-
return this._oidc.loginAsync(callbackPath, extras, isSilentSignin, scope, silentLoginOnly);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
logoutAsync(callbackPathOrUrl: string | null | undefined = undefined, extras: StringMap = null):Promise<void> {
|
|
46
|
-
return this._oidc.logoutAsync(callbackPathOrUrl, extras);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
silentLoginCallbackAsync():Promise<void> {
|
|
50
|
-
return this._oidc.silentLoginCallbackAsync();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
renewTokensAsync(extras:StringMap = null):Promise<void> {
|
|
54
|
-
return this._oidc.renewTokensAsync(extras);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
loginCallbackAsync():Promise<LoginCallback> {
|
|
58
|
-
return this._oidc.loginCallbackWithAutoTokensRenewAsync();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get tokens():Tokens {
|
|
62
|
-
return this._oidc.tokens;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get configuration():OidcConfiguration {
|
|
66
|
-
return this._oidc.configuration;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async getValidTokenAsync(waitMs = 200, numberWait = 50): Promise<ValidToken> {
|
|
70
|
-
return getValidTokenAsync(this._oidc, waitMs, numberWait);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async userInfoAsync<T extends OidcUserInfo = OidcUserInfo>(noCache = false):Promise<T> {
|
|
74
|
-
return this._oidc.userInfoAsync(noCache);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface OidcUserInfo {
|
|
79
|
-
sub: string;
|
|
80
|
-
name?: string;
|
|
81
|
-
given_name?: string;
|
|
82
|
-
family_name?: string;
|
|
83
|
-
middle_name?: string;
|
|
84
|
-
nickname?: string;
|
|
85
|
-
preferred_username?: string;
|
|
86
|
-
profile?: string;
|
|
87
|
-
picture?: string;
|
|
88
|
-
website?: string;
|
|
89
|
-
email?: string;
|
|
90
|
-
email_verified?: boolean;
|
|
91
|
-
gender?: string;
|
|
92
|
-
birthdate?: string;
|
|
93
|
-
zoneinfo?: string;
|
|
94
|
-
locale?: string;
|
|
95
|
-
phone_number?: string;
|
|
96
|
-
phone_number_verified?: boolean;
|
|
97
|
-
address?: OidcAddressClaim;
|
|
98
|
-
updated_at?: number;
|
|
99
|
-
groups?: string[];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface OidcAddressClaim {
|
|
103
|
-
formatted?: string;
|
|
104
|
-
street_address?: string;
|
|
105
|
-
locality?: string;
|
|
106
|
-
region?: string;
|
|
107
|
-
postal_code?: string;
|
|
108
|
-
country?: string;
|
|
109
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
|
|
4
|
-
import { style } from './style.js';
|
|
5
|
-
|
|
6
|
-
const AuthenticatingError: ComponentType<any> = ({ configurationName }) => (
|
|
7
|
-
<div className="oidc-authenticating" style={style}>
|
|
8
|
-
<div className="oidc-authenticating__container">
|
|
9
|
-
<h1 className="oidc-authenticating__title">Error authentication for {configurationName}</h1>
|
|
10
|
-
<p className="oidc-authenticating__content">An error occurred during authentication.</p>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export default AuthenticatingError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
import { style } from './style';
|
|
5
|
-
|
|
6
|
-
const Authenticating : PropsWithChildren<any> = ({ configurationName }) => (
|
|
7
|
-
<div className="oidc-authenticating" style={style}>
|
|
8
|
-
<div className="oidc-authenticating__container">
|
|
9
|
-
<h1 className="oidc-authenticating__title">Authentication in progress for {configurationName}</h1>
|
|
10
|
-
<p className="oidc-authenticating__content">You will be redirected to the login page.</p>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export default Authenticating;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
|
|
3
|
-
import { style } from './style.js';
|
|
4
|
-
|
|
5
|
-
export const CallBackSuccess: ComponentType<any> = ({ configurationName }) => (<><div className="oidc-callback" style={style}>
|
|
6
|
-
<div className="oidc-callback__container">
|
|
7
|
-
<h1 className="oidc-callback__title">Authentication complete for {configurationName}</h1>
|
|
8
|
-
<p className="oidc-callback__content">You will be redirected to your application.</p>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
<div>
|
|
12
|
-
</div>
|
|
13
|
-
</>
|
|
14
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
|
|
3
|
-
import { style } from './style.js';
|
|
4
|
-
|
|
5
|
-
const Loading : ComponentType<any> = ({ configurationName }) => (
|
|
6
|
-
<span className="oidc-loading" style={style}>
|
|
7
|
-
Loading for {configurationName}
|
|
8
|
-
</span>
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
export default Loading;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
|
|
4
|
-
import { style } from './style.js';
|
|
5
|
-
|
|
6
|
-
const ServiceWorkerNotSupported : ComponentType<any> = ({ configurationName }) => (
|
|
7
|
-
<div className="oidc-serviceworker" style={style}>
|
|
8
|
-
<div className="oidc-serviceworker__container">
|
|
9
|
-
<h1 className="oidc-serviceworker__title">Unable to authenticate on this browser for {configurationName}</h1>
|
|
10
|
-
<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>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export default ServiceWorkerNotSupported;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useOidc } from '../oidc';
|
|
4
|
-
import { style } from './style.js';
|
|
5
|
-
|
|
6
|
-
export const SessionLost: ComponentType<any> = ({ configurationName }) => {
|
|
7
|
-
const { login } = useOidc(configurationName);
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<div className="oidc-session-lost" style={style}>
|
|
11
|
-
<div className="oidc-session-lost__container">
|
|
12
|
-
<h1 className="oidc-session-lost__title">Session timed out for {configurationName}</h1>
|
|
13
|
-
<p className="oidc-session-lost__content">
|
|
14
|
-
Your session has expired. Please re-authenticate.
|
|
15
|
-
</p>
|
|
16
|
-
<button type="button" className="btn btn-primary" onClick={() => login(null)}>Login</button>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default SessionLost;
|
package/src/override/style.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
export const style: CSSProperties = {
|
|
4
|
-
color: 'rgb(53,110,255)',
|
|
5
|
-
backgroundColor: 'rgb(255 255 255 / 88%)',
|
|
6
|
-
position: 'absolute',
|
|
7
|
-
zIndex: 1000,
|
|
8
|
-
top: '0px',
|
|
9
|
-
bottom: '0px',
|
|
10
|
-
right: '0px',
|
|
11
|
-
left: '0px',
|
|
12
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|