Copy to ClipboardCopied!Toggle word wrapToggle overflow
在这里,我们设置了两个安全定义
OAuth2 - 带有通过提供的 url 的隐式授权
API Key - 使用来自名为 myHeader的 HTTP 标头的 api 键
然后,您需要通过引用其密钥(petstore_auth 或 api_key)来指定使用其他操作。
.get("/{id}/{date}").description("Find user by id and date").outType(User.class)
.security("api_key")
...
.put().description("Updates or create a user").type(User.class)
.security("petstore_auth", "write:pets,read:pets")
.get("/{id}/{date}").description("Find user by id and date").outType(User.class)
.security("api_key")
...
.put().description("Updates or create a user").type(User.class)
.security("petstore_auth", "write:pets,read:pets")
Copy to ClipboardCopied!Toggle word wrapToggle overflow
此处 get 操作使用 Api Key 安全性,put 操作使用带有允许的读取和写入片断范围的 OAuth 安全性。