【发布时间】:2022-01-17 20:20:31
【问题描述】:
我尝试添加springdoc-openapi-ui 和camel-springdoc-starter。效果还不错。
现在我在上下文路径 '/camel' 和缺少的 securitySchemes 上遇到了麻烦。
有谁知道如何做到这一点
我如何获得这样的配置?
{
"openapi": "3.0.1",
"info": {
"title": "some title",
"version": "0.8.15-SNAPSHOT"
},
"servers": [
{
"url": "http://localhost"
}
],
"security": [
{
"Keycloak": []
}
],
"components": {
"schemas": {
...
},
"securitySchemes": {
"Keycloak": {
"type": "oauth2",
"name": "Keycloak",
"flows": {
"password": {
"tokenUrl": "http://localhost:8080/auth/realms/sample-app/protocol/openid-connect/token",
"scopes": {
"email": "",
"profile": ""
}
}
}
}
}
}
}
使用这样的东西:
@Override
public void configure() {
restConfiguration()
.component("servlet")
.apiProperty("api.title", "RDF-Pub Server")
.apiProperty("api.version", appVersion)
.apiProperty("api.components.securitySchemes.Keycloak.type", "oauth2")
.apiProperty("api.components.securitySchemes.Keycloak.name", "Keycloak")
.apiProperty("api.components.securitySchemes.Keycloak.flows.password.tokenUrl", "http://localhost:8080/auth/realms/example-app/protocol/openid-connect/token")
.apiProperty("api.components.securitySchemes.Keycloak.flows.password.scopes.email", "")
.apiProperty("api.components.securitySchemes.Keycloak.flows.password.scopes.profile", "");
}
【问题讨论】:
标签: spring-boot apache-camel swagger openapi springdoc-ui