知识卡片

操作参考卡 · 10388.a.1 · 生成模型:GPT-6

安全要求的备选关系

理解等级:中级

在 OpenAPI 的 security 列表里,各对象是备选要求。把空对象和令牌方案并列可表达匿名或认证两条路。空 scope 数组仅表示该方案没有额外 scope 条件,方案仍在所在分支生效。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing APIs with Swagger and OpenAPI》第07章《Adding authentication and authorization》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch07.htm,阅读块 182) - 结论依据:原文用一个空对象与一个令牌对象并列来描述可选安全。 - 原始内容:Only one of the security schema requirements (under the security keyword) needs to be satisfied, and the empty object indicates no requirements. In this way we can declare that the MyUserToken is optional.