From 7115514d9c584d31dd4268ffeb1aa5be548eb37b Mon Sep 17 00:00:00 2001 From: Christiaan Goossens <9487666+christiaangoossens@users.noreply.github.com> Date: Fri, 26 Apr 2024 14:45:43 +0200 Subject: [PATCH] Fix optional JWKS route in DiscoveryController --- src/Laravel/DiscoveryController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Laravel/DiscoveryController.php b/src/Laravel/DiscoveryController.php index e6dd271..cd17041 100644 --- a/src/Laravel/DiscoveryController.php +++ b/src/Laravel/DiscoveryController.php @@ -13,7 +13,6 @@ public function __invoke(Request $request) 'issuer' => url('/'), 'authorization_endpoint' => route('passport.authorizations.authorize'), 'token_endpoint' => route('passport.token'), - 'jwks_uri' => route('openid.jwks'), 'response_types_supported' => [ 'code', 'token', @@ -41,6 +40,10 @@ public function __invoke(Request $request) $response['userinfo_endpoint'] = route('openid.userinfo'); } + if (Route::has('openid.jwks')) { + $response['jwks_uri'] = route('openid.jwks'); + } + return response()->json($response, 200, [], JSON_PRETTY_PRINT); } }