From 2b964bdd312e655fa7e72c45df2f15251d1b83c9 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Sun, 25 Oct 2026 16:00:46 +0800 Subject: [PATCH] fix(oauth-server): rename AuthorizationController::authorize to start The method clashed with AuthorizesRequests::authorize on the base controller, so loading the class was a fatal error and GET /oauth/authorize never worked. --- src/Http/Controllers/OAuthServer/AuthorizationController.php | 2 +- src/routes.php | 2 +- tests/Unit/Auth/OAuthServer/OAuthServerConsoleEndpointsTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Http/Controllers/OAuthServer/AuthorizationController.php b/src/Http/Controllers/OAuthServer/AuthorizationController.php index b25e58d8..597e2c16 100644 --- a/src/Http/Controllers/OAuthServer/AuthorizationController.php +++ b/src/Http/Controllers/OAuthServer/AuthorizationController.php @@ -19,7 +19,7 @@ */ class AuthorizationController extends Controller { - public function authorize(Request $request, OAuthServer $server): RedirectResponse + public function start(Request $request, OAuthServer $server): RedirectResponse { $consentPath = config('oauth-server.console_authorize_path', '/oauth/authorize'); diff --git a/src/routes.php b/src/routes.php index 4a411134..3058955b 100644 --- a/src/routes.php +++ b/src/routes.php @@ -36,7 +36,7 @@ function ($router) { $router->get('.well-known/openid-configuration', [Fleetbase\Http\Controllers\OAuthServer\DiscoveryController::class, 'configuration']); $router->get('.well-known/oauth-authorization-server', [Fleetbase\Http\Controllers\OAuthServer\DiscoveryController::class, 'configuration']); $router->prefix('oauth')->group(function ($router) { - $router->get('authorize', [Fleetbase\Http\Controllers\OAuthServer\AuthorizationController::class, 'authorize']); + $router->get('authorize', [Fleetbase\Http\Controllers\OAuthServer\AuthorizationController::class, 'start']); $router->get('jwks', [Fleetbase\Http\Controllers\OAuthServer\DiscoveryController::class, 'jwks']); $router->middleware(['throttle:600,1'])->group(function ($router) { $router->post('token', [Fleetbase\Http\Controllers\OAuthServer\TokenController::class, 'token']); diff --git a/tests/Unit/Auth/OAuthServer/OAuthServerConsoleEndpointsTest.php b/tests/Unit/Auth/OAuthServer/OAuthServerConsoleEndpointsTest.php index bde6cfa3..1013d96d 100644 --- a/tests/Unit/Auth/OAuthServer/OAuthServerConsoleEndpointsTest.php +++ b/tests/Unit/Auth/OAuthServer/OAuthServerConsoleEndpointsTest.php @@ -159,7 +159,7 @@ function oauth_console_command(Illuminate\Console\Command $command, array $input it('sends a valid request to the console consent screen, and errors where they belong', function () { [$client] = oauth_test_client(); $controller = new AuthorizationController(); - $authorize = fn (array $query) => $controller->authorize(Request::create('/oauth/authorize', 'GET', $query), oauth_test_server())->getTargetUrl(); + $authorize = fn (array $query) => $controller->start(Request::create('/oauth/authorize', 'GET', $query), oauth_test_server())->getTargetUrl(); expect($authorize(oauth_test_params($client, oauth_test_verifier())))->toStartWith('https://console.fleetbase.test/oauth/authorize?response_type=code&client_id=' . $client->id) ->and($authorize(oauth_test_params($client, oauth_test_verifier(), ['response_type' => 'token'])))->toStartWith(OAUTH_TEST_REDIRECT . '?error=unsupported_response_type')