mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
Refactored fido2 popup to use auth guard when routing to component, added BrowserRouterService to track previous page and route using that
This commit is contained in:
@@ -524,4 +524,17 @@ export abstract class StateService<T extends Account = Account> {
|
||||
value: Record<string, Record<string, boolean>>,
|
||||
options?: StorageOptions
|
||||
) => Promise<void>;
|
||||
/**
|
||||
* fetches string value of the URL stored here, usually only called after SSO flows.
|
||||
* @param options Defines the storage options for the URL; Defaults to Local Storage.
|
||||
* @returns route called prior to SSO routing to organizations configured IdP.
|
||||
*/
|
||||
getPreviousUrl: (options?: StorageOptions) => Promise<string>;
|
||||
/**
|
||||
* Store URL in local storage by default, but can be configured. Developed to handle
|
||||
* SSO routing to organizations configured IdP.
|
||||
* @param url URL of route
|
||||
* @param options Defines the storage options for the URL; Defaults to Local Storage.
|
||||
*/
|
||||
setPreviousUrl: (url: string, options?: StorageOptions) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -37,4 +37,5 @@ export class GlobalState {
|
||||
enableBrowserIntegrationFingerprint?: boolean;
|
||||
enableDuckDuckGoBrowserIntegration?: boolean;
|
||||
region?: string;
|
||||
previousUrl?: string;
|
||||
}
|
||||
|
||||
@@ -2828,6 +2828,23 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getPreviousUrl(options?: StorageOptions): Promise<string> {
|
||||
return (
|
||||
await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
|
||||
)?.previousUrl;
|
||||
}
|
||||
|
||||
async setPreviousUrl(url: string, options?: StorageOptions): Promise<void> {
|
||||
const globals = await this.getGlobals(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
|
||||
);
|
||||
globals.previousUrl = url;
|
||||
await this.saveGlobals(
|
||||
globals,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
|
||||
);
|
||||
}
|
||||
|
||||
protected async getGlobals(options: StorageOptions): Promise<TGlobalState> {
|
||||
let globals: TGlobalState;
|
||||
if (this.useMemory(options.storageLocation)) {
|
||||
|
||||
Reference in New Issue
Block a user