0

我已经将我的项目更新到 Springboot 版本 2.6.3 和 swagger 3。我需要支持授权 HTTPS 请求但@SecurityScheme仅支持 https 请求。有没有办法配置@SecurityScheme注释以支持 https 请求或任何其他解决方案?

4

1 回答 1

1

如果要使用httphttps ,则“指示”的是服务器 URL。仅指安全方案类型。要使用HTTPS ,请将服务器 URL更改为httpsType.HTTP

例子:

        return new OpenAPI().servers(List.of(new Server()
    .url("https://google.com")))
    .components(new Components()
        .addSecuritySchemes("xpto",
            new SecurityScheme()
                .type(Type.HTTP)));
于 2022-02-22T13:42:18.590 回答