web/flows: statically import webauthn-related stages for safari issues

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-06-23 19:26:31 +02:00
parent e50a296a18
commit e1efb47543
2 changed files with 11 additions and 3 deletions

View File

@ -34,6 +34,11 @@ import "../elements/LoadingOverlay";
import { first } from "../utils";
import "./stages/RedirectStage";
import "./stages/access_denied/AccessDeniedStage";
// Import webauthn-related stages to prevent issues on safari
// Which is overly sensitive to allowing things only in the context of a
// user interaction
import "./stages/authenticator_validate/AuthenticatorValidateStage";
import "./stages/authenticator_webauthn/WebAuthnAuthenticatorRegisterStage";
import "./stages/autosubmit/AutosubmitStage";
import { StageHost } from "./stages/base";
import "./stages/captcha/CaptchaStage";
@ -341,7 +346,6 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge}
></ak-stage-authenticator-static>`;
case "ak-stage-authenticator-webauthn":
await import("./stages/authenticator_webauthn/WebAuthnAuthenticatorRegisterStage");
return html`<ak-stage-authenticator-webauthn
.host=${this as StageHost}
.challenge=${this.challenge}
@ -353,7 +357,6 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge}
></ak-stage-authenticator-sms>`;
case "ak-stage-authenticator-validate":
await import("./stages/authenticator_validate/AuthenticatorValidateStage");
return html`<ak-stage-authenticator-validate
.host=${this as StageHost}
.challenge=${this.challenge}

View File

@ -15,6 +15,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";
import {
AuthenticatorValidationChallenge,
AuthenticatorValidationChallengeResponseRequest,
CurrentTenant,
DeviceChallenge,
DeviceClassesEnum,
FlowsApi,
@ -44,6 +45,10 @@ export class AuthenticatorValidateStage
return this.host.loading;
}
get tenant(): CurrentTenant {
return this.host.tenant;
}
@state()
_selectedDeviceChallenge?: DeviceChallenge;
@ -53,7 +58,7 @@ export class AuthenticatorValidateStage
// We don't use this.submit here, as we don't want to advance the flow.
// We just want to notify the backend which challenge has been selected.
new FlowsApi(DEFAULT_CONFIG).flowsExecutorSolve({
flowSlug: this.host.flowSlug,
flowSlug: this.host.flowSlug || "",
query: window.location.search.substring(1),
flowChallengeResponseRequest: {
// @ts-ignore