我使用 Nelmio APi Doc 3.4。昂首阔步。我想为我的 api 使用 apiKey 授权。我将配置设置为nelmio_api_doc.yaml
:
nelmio_api_doc:
documentation:
schemes: [https]
securityDefinitions:
app_api_key:
type: apiKey
description: 'App Api Key'
name: Authorization
in: header
security:
- app_api_key: []
在我的控制器中,我在注释中设置了参数:
....
@SWG\Parameter(
* name="Authorization",
* in="header",
* required=true,
* type="string",
* default="PUT HERE THE KEY",
* description="Authorization"
* )
*/
public function getProductAction()
{
....
}
但是我在哪里设置我的 ApiKey?例如,我有一个 apiKey“abc123”,我想根据插入键检查它?我不明白这个功能在哪里。有人可以帮我弄这个吗?