diff --git a/authentik/flows/challenge.py b/authentik/flows/challenge.py index 517bdbb27..05b7a4677 100644 --- a/authentik/flows/challenge.py +++ b/authentik/flows/challenge.py @@ -121,15 +121,19 @@ class FlowErrorChallenge(Challenge): class AccessDeniedChallenge(WithUserInfoChallenge): """Challenge when a flow's active stage calls `stage_invalid()`.""" - error_message = CharField(required=False) component = CharField(default="ak-stage-access-denied") + error_message = CharField(required=False) + class SessionEndChallenge(WithUserInfoChallenge): """Challenge for ending a session""" component = CharField(default="ak-stage-session-end") + application_name = CharField(required=True) + application_launch_url = CharField(required=False) + class PermissionDict(TypedDict): """Consent Permission""" diff --git a/schema.yml b/schema.yml index cb3b9120d..af808d704 100644 --- a/schema.yml +++ b/schema.yml @@ -40927,7 +40927,12 @@ components: type: string pending_user_avatar: type: string + application_name: + type: string + application_launch_url: + type: string required: + - application_name - pending_user - pending_user_avatar - type diff --git a/web/src/flow/FlowExecutor.ts b/web/src/flow/FlowExecutor.ts index 89d62e73a..6b6a4486f 100644 --- a/web/src/flow/FlowExecutor.ts +++ b/web/src/flow/FlowExecutor.ts @@ -392,6 +392,12 @@ export class FlowExecutor extends Interface implements StageHost { .host=${this as StageHost} .challenge=${this.challenge} >`; + case "ak-stage-session-end": + await import("@goauthentik/flow/providers/SessionEnd"); + return html``; // Internal stages case "ak-stage-flow-error": return html` { + static get styles(): CSSResult[] { + return [PFBase, PFLogin, PFForm, PFFormControl, PFTitle, PFButton]; + } + + render(): TemplateResult { + if (!this.challenge) { + return html` `; + } + const tenant = rootInterface()?.tenant; + return html`
+

${this.challenge.flowInfo?.title}

+
+
+
+

+ ${t`You've logged out of ${this.challenge.applicationName}. You can go back to the overview to launch another application, or log out of your authentik account.`} +

+ ${t`Go back to overview`} + ${tenant && tenant.flowInvalidation + ? html` + + + ${t`Log out of ${tenant.brandingTitle}`} + + ` + : html``} + ${this.challenge.applicationLaunchUrl + ? html` + + ${t`Log back into ${this.challenge.applicationName}`} + + ` + : html``} +
+
`; + } +}