0

I'm having a rest service implemented using Apache Camel with DSL defined in XML. The rest services provides Swagger API in json using camel-swagger-java plugin

Is springfox an alternative here?

The api is generated correctly, but missing securityDefinitions and security which is required. How can I include that in the generated api. I'm using basicAuth.

I need the below block in the json root

 "securityDefinitions": {
    "basicAuth": {
      "type": "basic",
      "description": "abc"
    }
  }

and below block inside different 'paths'

"security": [
  {
    "basicAuth": [

    ]
  }
]

Any input greatly appreciated

slashron
  • 277
  • 1
  • 4
  • 13

3 Answers3

1

This is not yet supported but we are working on adding this for the upcoming Apache Camel 2.22.0 release. You can follow the ticket here: https://issues.apache.org/jira/browse/CAMEL-9751

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
1

The ticket https://issues.apache.org/jira/browse/CAMEL-9751 was released so this functionality is available in Apache Camel 2.22.0 release.

A small example of its use:

<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>
   <!-- ... -->

With that you can use basic ad apike auth in your client.

Joselo
  • 127
  • 1
  • 10
-1

have you looked at this specification in swagger
http://swagger.io/specification/#securityDefinitionsObject