diff --git a/composer.json b/composer.json index 421d772..bd84903 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "php": "^8.1", "simplesamlphp/assert": "^1.0.0", - "simplesamlphp/simplesamlphp": "^2.2.0", + "simplesamlphp/simplesamlphp": "dev-bugfix/discopwer-duplicate-date-header", "simplesamlphp/composer-module-installer": "^1.3.4", "symfony/http-foundation": "^6.4.0" }, diff --git a/src/Controller/DiscoPower.php b/src/Controller/DiscoPower.php index 599b459..03c3bef 100644 --- a/src/Controller/DiscoPower.php +++ b/src/Controller/DiscoPower.php @@ -8,15 +8,15 @@ use SimpleSAML\Error; use SimpleSAML\Module\discopower\PowerIdPDisco; use SimpleSAML\Session; -use Symfony\Component\HttpFoundation\{JsonResponse, Request, Response, StreamedResponse}; +use Symfony\Component\HttpFoundation\{JsonResponse, Request, Response}; class DiscoPower { /** * @param \Symfony\Component\HttpFoundation\Request $request The current request. - * @return \Symfony\Component\HttpFoundation\StreamedResponse + * @return \Symfony\Component\HttpFoundation\Response */ - public function main(Request $request): StreamedResponse + public function main(Request $request): Response { try { $discoHandler = new PowerIdPDisco( @@ -29,7 +29,7 @@ public function main(Request $request): StreamedResponse } try { - return new StreamedResponse([$discoHandler, 'handleRequest']); + return $discoHandler->handleRequest(); } catch (Exception $exception) { // An error here should be caused by metadata throw new Error\Error('METADATA', $exception); diff --git a/src/PowerIdPDisco.php b/src/PowerIdPDisco.php index 82cd127..f462f60 100644 --- a/src/PowerIdPDisco.php +++ b/src/PowerIdPDisco.php @@ -13,6 +13,7 @@ use SimpleSAML\Utils; use SimpleSAML\XHTML\IdPDisco; use SimpleSAML\XHTML\Template; +use Symfony\Component\HttpFoundation\Response; /** * This class implements a generic IdP discovery service, for use in various IdP discovery service pages. This should @@ -289,10 +290,16 @@ protected function filterList(array $list): array * Handles a request to this discovery service. * * The IdP disco parameters should be set before calling this function. + * + * @return \Symfony\Component\HttpFoundation\Response */ - public function handleRequest(): void + public function handleRequest(): Response { $this->start(); + $result = $this->start(); + if ($result !== null) { + return $result; + } // no choice made. Show discovery service page $idpList = $this->getIdPList(); @@ -344,7 +351,7 @@ public function handleRequest(): void $t->data['tabNames'][$tab] = $translator::noop($translatableTag); } } - $t->send(); + return $t; }