All of the mid-session and step-up auth work
This commit is contained in:
parent
1f31e0f1f8
commit
562bdd00f1
1 changed files with 11437 additions and 1212 deletions
|
|
@ -102,6 +102,7 @@ export type OAuthProviderConfig = {
|
|||
export class BaseOAuthClientProvider implements OAuthClientProvider {
|
||||
private capturedAuthUrl: URL | null = null;
|
||||
private eventTarget: EventTarget | null = null;
|
||||
private suppressAuthorizationNavigation = false;
|
||||
|
||||
protected serverUrl: string;
|
||||
protected storage: OAuthStorage;
|
||||
|
|
@ -138,6 +139,11 @@ export class BaseOAuthClientProvider implements OAuthClientProvider {
|
|||
this.capturedAuthUrl = null;
|
||||
}
|
||||
|
||||
/** Capture authorize URL without navigating (step-up confirmation modal). */
|
||||
setSuppressAuthorizationNavigation(suppress: boolean): void {
|
||||
this.suppressAuthorizationNavigation = suppress;
|
||||
}
|
||||
|
||||
get scope(): string | undefined {
|
||||
return this.storage.getScope(this.serverUrl);
|
||||
}
|
||||
|
|
@ -217,17 +223,16 @@ export class BaseOAuthClientProvider implements OAuthClientProvider {
|
|||
// Capture URL for return value
|
||||
this.capturedAuthUrl = authorizationUrl;
|
||||
|
||||
// Dispatch event if event target is set
|
||||
if (this.eventTarget) {
|
||||
this.eventTarget.dispatchEvent(
|
||||
new CustomEvent("oauthAuthorizationRequired", {
|
||||
detail: { url: authorizationUrl },
|
||||
}),
|
||||
);
|
||||
if (!this.suppressAuthorizationNavigation) {
|
||||
if (this.eventTarget) {
|
||||
this.eventTarget.dispatchEvent(
|
||||
new CustomEvent("oauthAuthorizationRequired", {
|
||||
detail: { url: authorizationUrl },
|
||||
}),
|
||||
);
|
||||
}
|
||||
this.navigation.navigateToAuthorization(authorizationUrl);
|
||||
}
|
||||
|
||||
// Original navigation behavior
|
||||
this.navigation.navigateToAuthorization(authorizationUrl);
|
||||
}
|
||||
|
||||
async saveCodeVerifier(codeVerifier: string): Promise<void> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue