From 64d820b006cf65d4247eef497c92501eb6b3a98d Mon Sep 17 00:00:00 2001 From: Ilya Borisov <69649036+DriverCat@users.noreply.github.com> Date: Fri, 5 Aug 2022 08:21:42 +0300 Subject: [PATCH] Add PKCE config parameter (#486) * Add PKCE config parameter * Add if condition, move config option --- config/l5-swagger.php | 7 +++++++ resources/views/index.blade.php | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/config/l5-swagger.php b/config/l5-swagger.php index 28fff7c..b540d6c 100644 --- a/config/l5-swagger.php +++ b/config/l5-swagger.php @@ -275,6 +275,13 @@ * If set to true, it persists authorization data, and it would not be lost on browser close/refresh */ 'persist_authorization' => env('L5_SWAGGER_UI_PERSIST_AUTHORIZATION', false), + + 'oauth2' => [ + /* + * If set to true, adds PKCE to AuthorizationCodeGrant flow + */ + 'use_pkce_with_authorization_code_grant' => false, + ], ], ], /* diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index d22bc3c..da60ada 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -66,6 +66,12 @@ }) window.ui = ui + + @if(in_array('oauth2', array_column(config('l5-swagger.defaults.securityDefinitions.securitySchemes'), 'type'))) + ui.initOAuth({ + usePkceWithAuthorizationCodeGrant: "{!! (bool)config('l5-swagger.defaults.ui.authorization.oauth2.use_pkce_with_authorization_code_grant') !!}" + }) + @endif }