Apache camel 如何为使用swagger for camel REST服务生成的api指定“securityDefinitions”、“security”?

Apache camel 如何为使用swagger for camel REST服务生成的api指定“securityDefinitions”、“security”?,apache-camel,swagger,springfox,Apache Camel,Swagger,Springfox,我正在使用ApacheCamel和XML中定义的DSL实现rest服务。rest服务使用camel-Swagger java插件提供json格式的Swagger API springfox是这里的替代品吗 api生成正确,但缺少所需的securityDefinitions和security。如何将其包含在生成的api中。我用的是basicAuth 我需要json根目录中的以下块 "securityDefinitions": { "basicAuth": { "type":

我正在使用ApacheCamel和XML中定义的DSL实现rest服务。rest服务使用camel-Swagger java插件提供json格式的Swagger API

springfox是这里的替代品吗

api生成正确,但缺少所需的securityDefinitions和security。如何将其包含在生成的api中。我用的是basicAuth

我需要json根目录中的以下块

 "securityDefinitions": {
    "basicAuth": {
      "type": "basic",
      "description": "abc"
    }
  }
在不同“路径”内的块下方

"security": [
  {
    "basicAuth": [

    ]
  }
]

非常感谢您的任何意见

您是否大摇大摆地看了本规范

这还不受支持,但我们正在为即将发布的Apache Camel 2.22.0版本添加这一功能。您可以在此处查看票证:

票证已发布,因此此功能在Apache Camel 2.22.0版本中可用

其使用的一个小例子:

<restContext id="restEndpoints" xmlns="http://camel.apache.org/schema/spring">
    <rest path="/rest/service1" >
        <securityDefinitions>
            <apiKey key="api_key" name="Authorization" inHeader="true"/>
            <basicAuth key="basic"/>
        </securityDefinitions>
        <!-- we add one or more security configs in our endpoints -->
        <get uri="/" id="endpoint1" produces="application/json">
            <!-- description and params here -->
            <security key="api_key"/>
            <!-- the route that this request will be redirect -->
        </get>
        <get uri="/{Id}" id="endpoint2" produces="application/json">
            <!-- ... -->
            <security key="basic"/>
            <!-- ... -->
        </get>
   <!-- ... -->
有了它,您可以在客户端中使用基本的ad apike auth