From 795370fed4e8c3785c45319c089f7604015581fc Mon Sep 17 00:00:00 2001 From: Lumina Date: Sun, 15 Nov 2026 15:32:44 -0500 Subject: [PATCH] Return 201 Created from dynamic client registration RFC 7591 section 3.2.1 requires a successful client registration response to use HTTP 201 Created. The endpoint returned 200 OK, which strict clients reject. openid-client (used by @inrupt/solid-client-authn-node) fails with "expected 201 Created, got: 200 OK", so Node.js Solid apps could not log in against the pod at all. Co-Authored-By: Claude Opus 5.5 --- solid/lib/Controller/ServerController.php | 2 +- solid/tests/Unit/Controller/ServerControllerTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/solid/lib/Controller/ServerController.php b/solid/lib/Controller/ServerController.php index deeff6cd..7dc86e1c 100644 --- a/solid/lib/Controller/ServerController.php +++ b/solid/lib/Controller/ServerController.php @@ -443,7 +443,7 @@ public function register() { 'origin' => $clientData['origin'], ); $registration = $this->tokenGenerator->respondToRegistration($registration, $this->config->getPrivateKey()); - return (new JSONResponse($registration)); + return new JSONResponse($registration, Http::STATUS_CREATED); // ->addHeader('Access-Control-Allow-Origin', $origin) // ->addHeader('Access-Control-Allow-Methods', 'POST'); } diff --git a/solid/tests/Unit/Controller/ServerControllerTest.php b/solid/tests/Unit/Controller/ServerControllerTest.php index a6768aa7..dd83b7c6 100644 --- a/solid/tests/Unit/Controller/ServerControllerTest.php +++ b/solid/tests/Unit/Controller/ServerControllerTest.php @@ -394,7 +394,7 @@ public function testRegisterWithoutRedirectUris() } /** - * @testdox ServerController should return a 200 with client data when asked to register with valid redirect URIs + * @testdox ServerController should return a 201 with client data when asked to register with valid redirect URIs * * @covers ::register */ @@ -421,7 +421,7 @@ public function testRegisterWithRedirectUris() 'response_types' => ['id_token token'], 'token_endpoint_auth_method' => 'client_secret_basic', ]; - $expected = $this->createExpectedResponse(Http::STATUS_OK, $data); + $expected = $this->createExpectedResponse(Http::STATUS_CREATED, $data); $actualData = $response->getData(); $this->assertArrayHasKey('client_id', $actualData);