@lvce-editor/auth-worker 3.16.0 → 3.16.1
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/dist/authWorkerMain.js +7 -3
- package/package.json +1 -1
package/dist/authWorkerMain.js
CHANGED
|
@@ -2331,6 +2331,7 @@ const clientIdKey = 'oidcClientId';
|
|
|
2331
2331
|
const pendingClientIdKey = 'pendingOidcClientId';
|
|
2332
2332
|
const pendingCodeVerifierKey = 'pendingOidcCodeVerifier';
|
|
2333
2333
|
const pendingRedirectUriKey = 'pendingOidcRedirectUri';
|
|
2334
|
+
const pendingReturnUrlKey = 'pendingOidcReturnUrl';
|
|
2334
2335
|
const pendingStateKey = 'pendingOidcState';
|
|
2335
2336
|
const clearOidcCallbackUrl = async () => {
|
|
2336
2337
|
await clearPersistentAuthValue(callbackUrlKey);
|
|
@@ -2339,7 +2340,7 @@ const clearStoredOidcClientId = async () => {
|
|
|
2339
2340
|
await clearPersistentAuthValue(clientIdKey);
|
|
2340
2341
|
};
|
|
2341
2342
|
const clearPendingOidcAuthState = async () => {
|
|
2342
|
-
await Promise.all([clearPersistentAuthValue(pendingClientIdKey), clearPersistentAuthValue(pendingCodeVerifierKey), clearPersistentAuthValue(pendingRedirectUriKey), clearPersistentAuthValue(pendingStateKey)]);
|
|
2343
|
+
await Promise.all([clearPersistentAuthValue(pendingClientIdKey), clearPersistentAuthValue(pendingCodeVerifierKey), clearPersistentAuthValue(pendingRedirectUriKey), clearPersistentAuthValue(pendingReturnUrlKey), clearPersistentAuthValue(pendingStateKey)]);
|
|
2343
2344
|
};
|
|
2344
2345
|
const getOidcCallbackUrl = async () => {
|
|
2345
2346
|
return getPersistentAuthValue(callbackUrlKey);
|
|
@@ -2348,7 +2349,7 @@ const getStoredOidcClientId = async () => {
|
|
|
2348
2349
|
return getPersistentAuthValue(clientIdKey);
|
|
2349
2350
|
};
|
|
2350
2351
|
const loadPendingOidcAuthState = async () => {
|
|
2351
|
-
const [clientId, codeVerifier, redirectUri, state] = await Promise.all([getPersistentAuthValue(pendingClientIdKey), getPersistentAuthValue(pendingCodeVerifierKey), getPersistentAuthValue(pendingRedirectUriKey), getPersistentAuthValue(pendingStateKey)]);
|
|
2352
|
+
const [clientId, codeVerifier, redirectUri, returnUrl, state] = await Promise.all([getPersistentAuthValue(pendingClientIdKey), getPersistentAuthValue(pendingCodeVerifierKey), getPersistentAuthValue(pendingRedirectUriKey), getPersistentAuthValue(pendingReturnUrlKey), getPersistentAuthValue(pendingStateKey)]);
|
|
2352
2353
|
if (!clientId || !codeVerifier || !redirectUri || !state) {
|
|
2353
2354
|
return undefined;
|
|
2354
2355
|
}
|
|
@@ -2356,6 +2357,7 @@ const loadPendingOidcAuthState = async () => {
|
|
|
2356
2357
|
clientId,
|
|
2357
2358
|
codeVerifier,
|
|
2358
2359
|
redirectUri,
|
|
2360
|
+
returnUrl,
|
|
2359
2361
|
state
|
|
2360
2362
|
};
|
|
2361
2363
|
};
|
|
@@ -2363,7 +2365,7 @@ const saveOidcClientId = async clientId => {
|
|
|
2363
2365
|
await setPersistentAuthValue(clientIdKey, clientId);
|
|
2364
2366
|
};
|
|
2365
2367
|
const savePendingOidcAuthState = async value => {
|
|
2366
|
-
await Promise.all([setPersistentAuthValue(pendingClientIdKey, value.clientId), setPersistentAuthValue(pendingCodeVerifierKey, value.codeVerifier), setPersistentAuthValue(pendingRedirectUriKey, value.redirectUri), setPersistentAuthValue(pendingStateKey, value.state)]);
|
|
2368
|
+
await Promise.all([setPersistentAuthValue(pendingClientIdKey, value.clientId), setPersistentAuthValue(pendingCodeVerifierKey, value.codeVerifier), setPersistentAuthValue(pendingRedirectUriKey, value.redirectUri), setPersistentAuthValue(pendingReturnUrlKey, value.returnUrl), setPersistentAuthValue(pendingStateKey, value.state)]);
|
|
2367
2369
|
};
|
|
2368
2370
|
|
|
2369
2371
|
const normalizeRedirectUri = value => {
|
|
@@ -3186,10 +3188,12 @@ const getInteractiveLoginResult = async (backendUrl, platform, signingInState, p
|
|
|
3186
3188
|
state
|
|
3187
3189
|
} = await getBackendLoginRequest(backendUrl, platform, uid);
|
|
3188
3190
|
if (platform !== Electron) {
|
|
3191
|
+
const returnUrl = await getCurrentHref();
|
|
3189
3192
|
await savePendingOidcAuthState({
|
|
3190
3193
|
clientId,
|
|
3191
3194
|
codeVerifier,
|
|
3192
3195
|
redirectUri,
|
|
3196
|
+
returnUrl,
|
|
3193
3197
|
state
|
|
3194
3198
|
});
|
|
3195
3199
|
}
|