Skip to content

Commit 01ab5eb

Browse files
committed
Change error message for unregistered redirect URIs to specify provided URI.
1 parent 4bc8355 commit 01ab5eb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

solid/lib/Controller/ServerController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ServerController extends Controller
2323
{
2424
use DpopFactoryTrait;
2525

26+
public const ERROR_UNREGISTERED_URI = 'Provided redirect URI "%s" does not match any registered URIs';
2627
private $userId;
2728

2829
/* @var IUserManager */
@@ -229,13 +230,12 @@ public function authorize() {
229230
$redirectUris = $clientRegistration['redirect_uris'];
230231

231232
$validRedirectUris = array_filter($redirectUris, function ($uri) use ($redirectUri) {
232-
// @CHECKME: Does either URI need to be normalized when it is a URL?
233-
// For instance, anchors `#` or query parameters `?`
234233
return $uri === $redirectUri;
235234
});
236235

237236
if (count($validRedirectUris) === 0) {
238-
return new JSONResponse('Provided redirect URI does not match any registered URIs', Http::STATUS_BAD_REQUEST);
237+
$message = vsprintf(self::ERROR_UNREGISTERED_URI, [$redirectUri]);
238+
return new JSONResponse($message, Http::STATUS_BAD_REQUEST);
239239
}
240240
}
241241

solid/tests/Unit/Controller/ServerControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testAuthorizeWithInvalidRedirectUri()
195195
$response = $controller->authorize();
196196

197197
$expected = [
198-
'data' => 'Provided redirect URI does not match any registered URIs',
198+
'data' => vsprintf($controller::ERROR_UNREGISTERED_URI, [$_GET['redirect_uri']]),
199199
'headers' => [
200200
'Cache-Control' => 'no-cache, no-store, must-revalidate',
201201
'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'",

0 commit comments

Comments
 (0)