更新时间:2023-09-09 23:25:46
您需要在规范中添加一个安全方案:
You need to add a security scheme to your specification:
一种方法是使用批注:
@OpenAPIDefinition(info = @Info(title = "My API", version = "v1"))
@SecurityScheme(
name = "basicAuth",
type = SecuritySchemeType.HTTP,
scheme = "basic"
)
public class ExampleApiApplication extends Application {
}
启用安全方案后,授权按钮将出现在swagger ui上.安全方案可以是基本方案,也可以是载体方案.
After you enable security scheme, authorize button will appear on swagger ui. Securirty scheme can be basic, bearer etc..