api-platform / api-platform/core
Use the Open API Bearer Authentication with bearerFormat instead of Authorization Header for JWT Authentication
- 主要語言
- PHP
- 星號
- 2.6k
- 分支
- 980
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 48
描述
**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.
貢獻指南
評估
這個 Issue 還沒有評估資料。