OpenAPI 安全方案:'type' 在 Cookie 身份验证中的用途是什么?

OpenAPI Security Scheme: What is 'type' used for in Cookie auth?

OpenAPI 允许您指定各种 security schemes for authentication and authorization: basic auth, OAuth 2.0, etc. Among them is the simple scheme of having a token or key send in a specific cookie header field: Cookie Authentication.

根据 Swagger 页面上的示例,cookie 身份验证方案可能如下所示:

components:
  securitySchemes:
    cookieAuth:         # arbitrary name for the security scheme
      type: apiKey
      in: cookie
      name: JSESSIONID  # cookie name

我想知道已使用的 type 属性。根据latest OAS 3.0.2 spec类型属性是

但是有人可以让我知道这些不同类型的实际含义吗?这里的想法是重用 apiKey 类型,即使有问题的 key/token 不是实际的 API 键吗?

Is the idea here to just reuse the apiKey type... ?

是的。

术语 "API key" 非常通用,指的是 "some kind of a token that identifies the consumer" - 这包括身份验证 cookie。