+ $requestId = session()->pull('saml2_logout_request_id', null);
+ $redirect = $this->samlService->processSlsResponse($requestId) ?? '/';
+
+ return redirect($redirect);
+ }
+
+ /**
+ * Assertion Consumer Service start URL. Takes the SAMLResponse from the IDP.
+ * Due to being an external POST request, we likely won't have context of the
+ * current user session due to lax cookies. To work around this we store the
+ * SAMLResponse data and redirect to the processAcs endpoint for the actual
+ * processing of the request with proper context of the user session.
+ */
+ public function startAcs(Request $request)
+ {
+ $samlResponse = $request->get('SAMLResponse', null);
+
+ if (empty($samlResponse)) {
+ $this->showErrorNotification(trans('errors.saml_fail_authed', ['system' => config('saml2.name')]));
+
+ return redirect('/login');
+ }
+
+ $acsId = Str::random(16);
+ $cacheKey = 'saml2_acs:' . $acsId;
+ cache()->set($cacheKey, encrypt($samlResponse), 10);
+
+ return redirect()->guest('/saml2/acs?id=' . $acsId);