api-platform / api-platform/core
Use the Open API Bearer Authentication with bearerFormat instead of Authorization Header for JWT Authentication
- Linguagem predominante
- PHP
- Estrelas
- 2.6k
- Forks
- 980
- Merge médio
- 2d 5h
- PRs com merge (30d)
- 48
Descrição
**Description**
In the Open API v3 specification, it's possible to set a configuration for Bearer Authentication with the JWT format (see https://swagger.io/docs/specification/authentication/bearer-authentication/). Using this configuration means you don't have to copy and paste the word `BEARER ` every time.
**Example**
ATM, I've decorated the `api_platform.openapi.factory` this way :
```php
decorated)($context);
$schemas = $openApi->getComponents()->getSecuritySchemes();
$schemas['JWT'] = new \ArrayObject([
'type' => 'http',
'scheme' => 'bearer',
'bearerFormat' => 'JWT'
]);
return $openApi;
}
}
```
but I think it could be better if we could set the `bearerFormat` directly in the Api Platform configuration.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.