From 71f916eebd6147bbbd3d12b3bc30d575550e3032 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Fri, 27 Aug 2021 23:23:30 +0200 Subject: [PATCH] Fix request --- modules/exampleauth/lib/Auth/Source/External.php | 8 +++++--- modules/exampleauth/lib/Controller/ExampleAuth.php | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/exampleauth/lib/Auth/Source/External.php b/modules/exampleauth/lib/Auth/Source/External.php index 5d703b843..82216fdab 100644 --- a/modules/exampleauth/lib/Auth/Source/External.php +++ b/modules/exampleauth/lib/Auth/Source/External.php @@ -183,16 +183,18 @@ class External extends Auth\Source * This function resumes the authentication process after the user has * entered his or her credentials. * + * @param \Symfony\Component\HttpFoundation\Request $request + * * @throws \SimpleSAML\Error\BadRequest * @throws \SimpleSAML\Error\Exception */ - public static function resume(): void + public static function resume(Request $request): void { /* * First we need to restore the $state-array. We should have the identifier for * it in the 'State' request parameter. */ - if (!isset($_REQUEST['State'])) { + if (!$request->has('State')) { throw new Error\BadRequest('Missing "State" parameter.'); } @@ -201,7 +203,7 @@ class External extends Auth\Source * match the string we used in the saveState-call above. */ /** @var array $state */ - $state = Auth\State::loadState($_REQUEST['State'], 'exampleauth:External'); + $state = Auth\State::loadState($request->get('State'), 'exampleauth:External'); /* * Now we have the $state-array, and can use it to locate the authentication diff --git a/modules/exampleauth/lib/Controller/ExampleAuth.php b/modules/exampleauth/lib/Controller/ExampleAuth.php index ada3e653b..bcbee53b2 100644 --- a/modules/exampleauth/lib/Controller/ExampleAuth.php +++ b/modules/exampleauth/lib/Controller/ExampleAuth.php @@ -200,7 +200,7 @@ class ExampleAuth * * @return \SimpleSAML\HTTP\RunnableResponse */ - public function resume(/** @scrutinizer ignore-unused */ Request $request): RunnableResponse + public function resume(Request $request): RunnableResponse { /** * This page serves as the point where the user's authentication @@ -208,7 +208,6 @@ class ExampleAuth * * It simply passes control back to the class. */ - - return new RunnableResponse([External::class, 'resume'], []); + return new RunnableResponse([External::class, 'resume'], [$request]); } } -- GitLab