You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update JWT Documentation with the OpenApi way (#1240)
* Update JWT Documentation
Update with the new OpenApi documentation way. It works with Api Platform 2.6.0 beta 1
* docs: minor tweaks to jwt.md
Co-authored-by: Kévin Dunglas <[email protected]>
@@ -181,9 +181,7 @@ All you have to do is configure the API key in the `value` field.
181
181
By default, [only the authorization header mode is enabled](https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md#2-use-the-token) in LexikJWTAuthenticationBundle.
182
182
You must set the [JWT token](https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md#1-obtain-the-token) as below and click on the "Authorize" button.
183
183
184
-
```
185
-
Bearer MY_NEW_TOKEN
186
-
```
184
+
Bearer MY_NEW_TOKEN
187
185
188
186

189
187
@@ -193,108 +191,99 @@ We can add a `POST /authentication_token` endpoint to SwaggerUI to conveniently
193
191
194
192

195
193
196
-
To do it, we need to create a `SwaggerDecorator`:
194
+
To do it, we need to create a decorator:
197
195
198
196
```php
199
197
<?php
198
+
// api/src/OpenApi/JwtDecorator.php
200
199
201
200
declare(strict_types=1);
202
201
203
-
namespace App\Swagger;
202
+
namespace App\OpenApi;
204
203
205
-
use Symfony\Component\HttpFoundation\Response;
206
-
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
204
+
use ApiPlatform\Core\OpenApi\Factory\OpenApiFactoryInterface;
205
+
use ApiPlatform\Core\OpenApi\OpenApi;
206
+
use ApiPlatform\Core\OpenApi\Model;
207
207
208
-
final class SwaggerDecorator implements NormalizerInterface
208
+
final class JwtDecorator implements OpenApiFactoryInterface
209
209
{
210
-
private NormalizerInterface $decorated;
211
-
212
-
public function __construct(NormalizerInterface $decorated)
213
-
{
214
-
$this->decorated = $decorated;
215
-
}
216
-
217
-
public function supportsNormalization($data, string $format = null): bool
0 commit comments