api-platform / api-platform/core

Use the Open API Bearer Authentication with bearerFormat instead of Authorization Header for JWT Authentication

未關閉
#8,084 0 則留言 4 個 reaction 已指派 0 人 在 GitHub 檢視
OpenAPI
主要語言
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 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。