diff --git a/authentik/providers/rac/views.py b/authentik/providers/rac/views.py index 9babd12733b8..b9a5b5f8a927 100644 --- a/authentik/providers/rac/views.py +++ b/authentik/providers/rac/views.py @@ -20,6 +20,9 @@ from authentik.policies.engine import PolicyEngine from authentik.policies.views import PolicyAccessView from authentik.providers.rac.models import ConnectionToken, Endpoint, RACProvider +from authentik.stages.prompt.stage import PLAN_CONTEXT_PROMPT + +PLAN_CONNECTION_SETTINGS = "connection_settings" class RACStartView(PolicyAccessView): @@ -109,10 +112,15 @@ def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpRespo return super().dispatch(request, *args, **kwargs) def get_challenge(self, *args, **kwargs) -> RedirectChallenge: + settings = self.executor.plan.context.get(PLAN_CONNECTION_SETTINGS) + if not settings: + settings = self.executor.plan.context.get(PLAN_CONTEXT_PROMPT, {}).get( + PLAN_CONNECTION_SETTINGS + ) token = ConnectionToken.objects.create( provider=self.provider, endpoint=self.endpoint, - settings=self.executor.plan.context.get("connection_settings", {}), + settings=settings or {}, session=self.request.session["authenticatedsession"], expires=now() + timedelta_from_string(self.provider.connection_expiry), expiring=True,