Skip to content

Commit ec942aa

Browse files
fix: review
1 parent 159ecc2 commit ec942aa

File tree

6 files changed

+17
-19
lines changed

6 files changed

+17
-19
lines changed

src/Core/Bridge/Symfony/Bundle/Action/SwaggerUiAction.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ final class SwaggerUiAction
5656
private $oauthTokenUrl;
5757
private $oauthAuthorizationUrl;
5858
private $oauthScopes;
59-
private $oauthPKCE;
59+
private $oauthPkce;
6060
private $formatsProvider;
6161
private $swaggerUiEnabled;
6262
private $reDocEnabled;
@@ -80,10 +80,9 @@ final class SwaggerUiAction
8080
* @param mixed $oauthTokenUrl
8181
* @param mixed $oauthAuthorizationUrl
8282
* @param mixed $oauthScopes
83-
* @param mixed $oauthPKCE
8483
* @param mixed $resourceMetadataFactory
8584
*/
86-
public function __construct(ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, $resourceMetadataFactory, NormalizerInterface $normalizer, ?TwigEnvironment $twig, UrlGeneratorInterface $urlGenerator, string $title = '', string $description = '', string $version = '', $formats = [], $oauthEnabled = false, $oauthClientId = '', $oauthClientSecret = '', $oauthType = '', $oauthFlow = '', $oauthTokenUrl = '', $oauthAuthorizationUrl = '', $oauthScopes = [], bool $oauthPKCE = true, bool $showWebby = true, bool $swaggerUiEnabled = false, bool $reDocEnabled = false, bool $graphqlEnabled = false, bool $graphiQlEnabled = false, bool $graphQlPlaygroundEnabled = false, array $swaggerVersions = [2, 3], OpenApiSwaggerUiAction $swaggerUiAction = null, $assetPackage = null, array $swaggerUiExtraConfiguration = [])
85+
public function __construct(ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, $resourceMetadataFactory, NormalizerInterface $normalizer, ?TwigEnvironment $twig, UrlGeneratorInterface $urlGenerator, string $title = '', string $description = '', string $version = '', $formats = [], $oauthEnabled = false, $oauthClientId = '', $oauthClientSecret = '', $oauthType = '', $oauthFlow = '', $oauthTokenUrl = '', $oauthAuthorizationUrl = '', $oauthScopes = [], bool $oauthPkce = false, bool $showWebby = true, bool $swaggerUiEnabled = false, bool $reDocEnabled = false, bool $graphqlEnabled = false, bool $graphiQlEnabled = false, bool $graphQlPlaygroundEnabled = false, array $swaggerVersions = [2, 3], OpenApiSwaggerUiAction $swaggerUiAction = null, $assetPackage = null, array $swaggerUiExtraConfiguration = [])
8786
{
8887
$this->resourceNameCollectionFactory = $resourceNameCollectionFactory;
8988
$this->resourceMetadataFactory = $resourceMetadataFactory;
@@ -102,7 +101,7 @@ public function __construct(ResourceNameCollectionFactoryInterface $resourceName
102101
$this->oauthTokenUrl = $oauthTokenUrl;
103102
$this->oauthAuthorizationUrl = $oauthAuthorizationUrl;
104103
$this->oauthScopes = $oauthScopes;
105-
$this->oauthPKCE = $oauthPKCE;
104+
$this->oauthPkce = $oauthPkce;
106105
$this->swaggerUiEnabled = $swaggerUiEnabled;
107106
$this->reDocEnabled = $reDocEnabled;
108107
$this->graphqlEnabled = $graphqlEnabled;
@@ -186,7 +185,7 @@ private function getContext(Request $request, Documentation $documentation): arr
186185
'enabled' => $this->oauthEnabled,
187186
'clientId' => $this->oauthClientId,
188187
'clientSecret' => $this->oauthClientSecret,
189-
'pkce' => $this->oauthPKCE,
188+
'pkce' => $this->oauthPkce,
190189
'type' => $this->oauthType,
191190
'flow' => $this->oauthFlow,
192191
'tokenUrl' => $this->oauthTokenUrl,

src/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,9 @@ private function addOAuthSection(ArrayNodeDefinition $rootNode): void
262262
->scalarNode('clientId')->defaultValue('')->info('The oauth client id.')->end()
263263
->scalarNode('clientSecret')
264264
->defaultValue('')
265-
->info('The oauth client secret.')
266-
->setDeprecated(...$this->buildDeprecationArgs('2.7', 'The use of the `oauth.client_secret` has been deprecated in 2.7 for security reasons and will be removed in 3.0. The `oauth.pkce` option implements the OAuth2 PKCE strategy (enabled by default).'))
265+
->info('The oauth client secret. Never use this parameter in your production environment. It exposes crucial security information. This feature is intended for dev/test environments only. Enable `oauth.pkce` instead')
267266
->end()
268-
->booleanNode('pkce')->defaultTrue()->info('Enable the oauth PKCE.')->end()
267+
->booleanNode('pkce')->defaultFalse()->info('Enable the oauth PKCE.')->end()
269268
->scalarNode('type')->defaultValue('oauth2')->info('The oauth type.')->end()
270269
->scalarNode('flow')->defaultValue('application')->info('The oauth flow grant type.')->end()
271270
->scalarNode('tokenUrl')->defaultValue('')->info('The oauth token url.')->end()

src/Symfony/Bundle/SwaggerUi/SwaggerUiAction.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ final class SwaggerUiAction
4040
private $resourceMetadataFactory;
4141
private $oauthClientId;
4242
private $oauthClientSecret;
43-
private $oauthPKCE;
43+
private $oauthPkce;
4444

45-
public function __construct($resourceMetadataFactory, ?TwigEnvironment $twig, UrlGeneratorInterface $urlGenerator, NormalizerInterface $normalizer, OpenApiFactoryInterface $openApiFactory, Options $openApiOptions, SwaggerUiContext $swaggerUiContext, array $formats = [], string $oauthClientId = null, string $oauthClientSecret = null, bool $oauthPKCE = true)
45+
public function __construct($resourceMetadataFactory, ?TwigEnvironment $twig, UrlGeneratorInterface $urlGenerator, NormalizerInterface $normalizer, OpenApiFactoryInterface $openApiFactory, Options $openApiOptions, SwaggerUiContext $swaggerUiContext, array $formats = [], string $oauthClientId = null, string $oauthClientSecret = null, bool $oauthPkce = false)
4646
{
4747
$this->resourceMetadataFactory = $resourceMetadataFactory;
4848
$this->twig = $twig;
@@ -54,7 +54,7 @@ public function __construct($resourceMetadataFactory, ?TwigEnvironment $twig, Ur
5454
$this->formats = $formats;
5555
$this->oauthClientId = $oauthClientId;
5656
$this->oauthClientSecret = $oauthClientSecret;
57-
$this->oauthPKCE = $oauthPKCE;
57+
$this->oauthPkce = $oauthPkce;
5858

5959
if (null === $this->twig) {
6060
throw new \RuntimeException('The documentation cannot be displayed since the Twig bundle is not installed. Try running "composer require symfony/twig-bundle".');
@@ -91,7 +91,7 @@ public function __invoke(Request $request)
9191
'scopes' => $this->openApiOptions->getOAuthScopes(),
9292
'clientId' => $this->oauthClientId,
9393
'clientSecret' => $this->oauthClientSecret,
94-
'pkce' => $this->oauthPKCE,
94+
'pkce' => $this->oauthPkce,
9595
],
9696
'extraConfiguration' => $this->swaggerUiContext->getExtraConfiguration(),
9797
];

tests/Symfony/Bundle/Action/SwaggerUiActionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function getInvokeParameters()
102102
'tokenUrl' => '',
103103
'authorizationUrl' => '',
104104
'scopes' => [],
105-
'pkce' => true,
105+
'pkce' => false,
106106
],
107107
'shortName' => 'F',
108108
'operationId' => 'getFCollection',
@@ -138,7 +138,7 @@ public function getInvokeParameters()
138138
'tokenUrl' => '',
139139
'authorizationUrl' => '',
140140
'scopes' => [],
141-
'pkce' => true,
141+
'pkce' => false,
142142
],
143143
'shortName' => 'F',
144144
'operationId' => 'getFItem',
@@ -197,7 +197,7 @@ public function testDoNotRunCurrentRequest(Request $request)
197197
'tokenUrl' => '',
198198
'authorizationUrl' => '',
199199
'scopes' => [],
200-
'pkce' => true,
200+
'pkce' => false,
201201
],
202202
],
203203
])->shouldBeCalled()->willReturn('');

tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function runDefaultConfigTests(array $doctrineIntegrationsToLoad = ['orm
148148
'authorizationUrl' => '',
149149
'refreshUrl' => '',
150150
'scopes' => [],
151-
'pkce' => true,
151+
'pkce' => false,
152152
],
153153
'swagger' => [
154154
'versions' => [2, 3],

tests/Symfony/Bundle/SwaggerUi/SwaggerUiActionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getInvokeParameters()
104104
'tokenUrl' => '',
105105
'authorizationUrl' => '',
106106
'scopes' => [],
107-
'pkce' => true,
107+
'pkce' => false,
108108
],
109109
'extraConfiguration' => [],
110110
'shortName' => 'F',
@@ -140,7 +140,7 @@ public function getInvokeParameters()
140140
'tokenUrl' => '',
141141
'authorizationUrl' => '',
142142
'scopes' => [],
143-
'pkce' => true,
143+
'pkce' => false,
144144
],
145145
'extraConfiguration' => [],
146146
'shortName' => 'F',
@@ -194,7 +194,7 @@ public function testDoNotRunCurrentRequest(Request $request)
194194
'tokenUrl' => '',
195195
'authorizationUrl' => '',
196196
'scopes' => [],
197-
'pkce' => true,
197+
'pkce' => false,
198198
],
199199
'extraConfiguration' => [],
200200
],

0 commit comments

Comments
 (0)