Esempio n. 1
0
 def execute(self, request: Request, slug: str):
     """Execute flow for current user"""
     # Because we pre-plan the flow here, and not in the planner, we need to manually clear
     # the history of the inspector
     request.session[SESSION_KEY_HISTORY] = []
     flow: Flow = self.get_object()
     planner = FlowPlanner(flow)
     planner.use_cache = False
     try:
         plan = planner.plan(self.request, {PLAN_CONTEXT_PENDING_USER: request.user})
         self.request.session[SESSION_KEY_PLAN] = plan
     except FlowNonApplicableException as exc:
         return bad_request_message(
             request,
             _(
                 "Flow not applicable to current user/request: %(messages)s"
                 % {"messages": str(exc)}
             ),
         )
     return Response(
         {
             "link": request._request.build_absolute_uri(
                 reverse("authentik_core:if-flow", kwargs={"flow_slug": flow.slug})
             )
         }
     )
Esempio n. 2
0
 def test_inner():
     planner = FlowPlanner(self.flow)
     planner.use_cache = False
     planner.plan(self.request, {PLAN_CONTEXT_PENDING_USER: self.user})