@lvce-editor/auth-worker 3.16.0 → 3.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authWorkerMain.js +10 -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 => {
|
|
@@ -2447,6 +2449,9 @@ const getAccountProfile = async (backendUrl, accessToken, fetchFn = fetch) => {
|
|
|
2447
2449
|
throw new Error('The backend did not return an account identity.');
|
|
2448
2450
|
}
|
|
2449
2451
|
return {
|
|
2452
|
+
...(typeof value.avatarUrl === 'string' && {
|
|
2453
|
+
avatarUrl: value.avatarUrl
|
|
2454
|
+
}),
|
|
2450
2455
|
displayName: typeof value.displayName === 'string' ? value.displayName : '',
|
|
2451
2456
|
email: typeof value.email === 'string' ? value.email : '',
|
|
2452
2457
|
id: value.id,
|
|
@@ -3186,10 +3191,12 @@ const getInteractiveLoginResult = async (backendUrl, platform, signingInState, p
|
|
|
3186
3191
|
state
|
|
3187
3192
|
} = await getBackendLoginRequest(backendUrl, platform, uid);
|
|
3188
3193
|
if (platform !== Electron) {
|
|
3194
|
+
const returnUrl = await getCurrentHref();
|
|
3189
3195
|
await savePendingOidcAuthState({
|
|
3190
3196
|
clientId,
|
|
3191
3197
|
codeVerifier,
|
|
3192
3198
|
redirectUri,
|
|
3199
|
+
returnUrl,
|
|
3193
3200
|
state
|
|
3194
3201
|
});
|
|
3195
3202
|
}
|