[FAQ] swagger-php 支持 Authorization Bearer token 校验的用法

通过llama.cpp与羊驼聊天的网页界面- 详解 Serge 的启动使用

 

@OA\SecurityScheme 可以是 Controller 层面也可以是 Action 层面。

类型 type="apiKey"。

in="header" 表示在 header 头中。

name 定义请求头的 key 名为 Authorization。

securityScheme="xx",Authorization 的值会带上 swagger ui 上设置的值。

 

@OA\Post 对应到具体的方法,在 security 中指定 securityScheme 的值。

     * @OA\SecurityScheme(
     *     type="apiKey",
     *     in="header",
     *     securityScheme="Bearer",
     *     name="Authorization"
     * )
     *
     * @OA\Post(
     *     path="/api/v1/create",
     *     security={
     *       {"Bearer":{}}
     *     },
     *     @OA\Response(
     *         response="default",
     *         description="successful operation"
     *     )
     * )

 

Link:https://www.cnblogs.com/farwish/p/14016676.html

posted on 2020-11-21 18:35  ercom  阅读(826)  评论(0编辑  收藏  举报