From 309d634851a94013b61ce8e08d08a4a18e48abec Mon Sep 17 00:00:00 2001 From: Boen_Shi Date: Thu, 21 May 2026 17:17:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(Oauth2):=20=E8=A7=A3=E5=86=B3well-known?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=AE=BF=E9=97=AE=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=88=AB=E5=90=8D=E6=9B=BF=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/OauthMetadataController.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/Http/Controllers/Api/OauthMetadataController.php b/app/Http/Controllers/Api/OauthMetadataController.php index 0e75d5f..d90253d 100644 --- a/app/Http/Controllers/Api/OauthMetadataController.php +++ b/app/Http/Controllers/Api/OauthMetadataController.php @@ -42,6 +42,32 @@ class OauthMetadataController extends Controller ]); } + #[Apidoc\Title('OIDC Discovery 2'), Apidoc\Method('GET'), Apidoc\Url('/well-known/openid-configuration')] + public function openidConfiguration2(): JsonResponse + { + $scopes = OauthScope::query() + ->where('is_active', true) + ->orderBy('name') + ->pluck('name') + ->values() + ->all(); + + return response()->json([ + 'issuer' => (string) config('oauth.issuer'), + 'authorization_endpoint' => URL::to('/oauth/authorize'), + 'token_endpoint' => URL::to('/oauth/token'), + 'userinfo_endpoint' => URL::to('/oauth/userinfo'), + 'jwks_uri' => URL::to('/oauth/jwks'), + 'response_types_supported' => ['code'], + 'subject_types_supported' => ['public'], + 'id_token_signing_alg_values_supported' => ['RS256'], + 'scopes_supported' => $scopes, + 'token_endpoint_auth_methods_supported' => ['client_secret_basic', 'client_secret_post'], + 'grant_types_supported' => ['authorization_code', 'refresh_token'], + 'claims_supported' => ['iss', 'sub', 'aud', 'exp', 'iat', 'auth_time', 'nonce', 'at_hash', 'nickname', 'email', 'phone'], + ]); + } + #[Apidoc\Title('JWKS'), Apidoc\Method('GET'), Apidoc\Url('/oauth/jwks')] public function jwks(): JsonResponse {