From 09c08a60903c36892c3d7f54b3013bbc599862f7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 22 Mar 2023 23:42:08 +0100 Subject: [PATCH] add web stage for session end Signed-off-by: Jens Langhammer --- authentik/flows/challenge.py | 6 ++- schema.yml | 5 +++ web/src/flow/FlowExecutor.ts | 6 +++ web/src/flow/providers/SessionEnd.ts | 62 ++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 web/src/flow/providers/SessionEnd.ts 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` + `; + } +}