From 0e4e7ccb4b156ee1a9a5aa94d2956fb720bfd94e Mon Sep 17 00:00:00 2001 From: Wouter van Os Date: Tue, 22 Oct 2024 18:14:14 +0200 Subject: [PATCH] core: add prompt_data to auth flow (#11702) I added the prompt_data and user_path to the auth flow. This allows us to more easily sync users details whenever they're logged in through a Source by using the Write stage, identical to an Enrolment flow. This makes sure that mappings etc are automatically taken into consideration, and are passed to the Authentication flow. While I was at it, I made the code consistent with the `handle_enroll` method. Signed-off-by: Wouter van Os --- authentik/core/sources/flow_manager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/authentik/core/sources/flow_manager.py b/authentik/core/sources/flow_manager.py index 5ec95df0c21b..7b1e115e09a7 100644 --- a/authentik/core/sources/flow_manager.py +++ b/authentik/core/sources/flow_manager.py @@ -272,7 +272,6 @@ def handle_auth( connection: UserSourceConnection, ) -> HttpResponse: """Login user and redirect.""" - flow_kwargs = {PLAN_CONTEXT_PENDING_USER: connection.user} return self._prepare_flow( self.source.authentication_flow, connection, @@ -286,7 +285,11 @@ def handle_auth( ), ) ], - **flow_kwargs, + **{ + PLAN_CONTEXT_PENDING_USER: connection.user, + PLAN_CONTEXT_PROMPT: delete_none_values(self.user_properties), + PLAN_CONTEXT_USER_PATH: self.source.get_user_path(), + }, ) def handle_existing_link(