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 { first } from "../utils";
import "./stages/RedirectStage"; import "./stages/RedirectStage";
import "./stages/access_denied/AccessDeniedStage"; 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 "./stages/autosubmit/AutosubmitStage";
import { StageHost } from "./stages/base"; import { StageHost } from "./stages/base";
import "./stages/captcha/CaptchaStage"; import "./stages/captcha/CaptchaStage";
@ -341,7 +346,6 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-authenticator-static>`; ></ak-stage-authenticator-static>`;
case "ak-stage-authenticator-webauthn": case "ak-stage-authenticator-webauthn":
await import("./stages/authenticator_webauthn/WebAuthnAuthenticatorRegisterStage");
return html`<ak-stage-authenticator-webauthn return html`<ak-stage-authenticator-webauthn
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}
@ -353,7 +357,6 @@ export class FlowExecutor extends LitElement implements StageHost {
.challenge=${this.challenge} .challenge=${this.challenge}
></ak-stage-authenticator-sms>`; ></ak-stage-authenticator-sms>`;
case "ak-stage-authenticator-validate": case "ak-stage-authenticator-validate":
await import("./stages/authenticator_validate/AuthenticatorValidateStage");
return html`<ak-stage-authenticator-validate return html`<ak-stage-authenticator-validate
.host=${this as StageHost} .host=${this as StageHost}
.challenge=${this.challenge} .challenge=${this.challenge}

View File

@ -15,6 +15,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { import {
AuthenticatorValidationChallenge, AuthenticatorValidationChallenge,
AuthenticatorValidationChallengeResponseRequest, AuthenticatorValidationChallengeResponseRequest,
CurrentTenant,
DeviceChallenge, DeviceChallenge,
DeviceClassesEnum, DeviceClassesEnum,
FlowsApi, FlowsApi,
@ -44,6 +45,10 @@ export class AuthenticatorValidateStage
return this.host.loading; return this.host.loading;
} }
get tenant(): CurrentTenant {
return this.host.tenant;
}
@state() @state()
_selectedDeviceChallenge?: DeviceChallenge; _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 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. // We just want to notify the backend which challenge has been selected.
new FlowsApi(DEFAULT_CONFIG).flowsExecutorSolve({ new FlowsApi(DEFAULT_CONFIG).flowsExecutorSolve({
flowSlug: this.host.flowSlug, flowSlug: this.host.flowSlug || "",
query: window.location.search.substring(1), query: window.location.search.substring(1),
flowChallengeResponseRequest: { flowChallengeResponseRequest: {
// @ts-ignore // @ts-ignore