OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swagger securityDefinition


Hi

There is a JIRA ticket about adding security to camel-swagger-java
https://issues.apache.org/jira/browse/CAMEL-9751

Contributions is welcome
http://camel.apache.org/contributing

On Wed, Jun 6, 2018 at 3:54 PM, Riaan Annandale <riaana@xxxxxxxxxxxxx> wrote:
> Hi guys
>
> I’ve deployed Redhat SSO/ Key cloak and am successfully able to use it as a bearer-only client to verify tokens before executing webservices as defined by my restConfiguration
>
> What I would like to do next is extend the swagger doc that gets generated to include securityDefinitions for documentation purposes like this:
>    "securityDefinitions":{
>       "petstore_auth":{
>          "type":"oauth2",
>          "authorizationUrl":"http://petstore.swagger.io/oauth/dialog";,
>          "flow":"implicit",
>          "scopes":{
>             "write:pets":"modify pets in your account",
>             "read:pets":"read your pets"
>          }
>       },
>       "api_key":{
>          "type":"apiKey",
>          "name":"api_key",
>          "in":"header"
>       }
>    }
>
> Example from http://petstore.swagger.io/
>
> I see I am able to give the restConfig it’s own apiComponent but do not see how to get something like:
>         Swagger swagger = new Swagger().info(info);
>         swagger.securityDefinition("petstore_auth",
>                 new OAuth2Definition()
>                         .implicit("http://petstore.swagger.io/api/oauth/dialog";)
>                         .scope("read:pets", "read your pets")
>                         .scope("write:pets", "modify pets in your account"));
> Into the component
>
> Has anyone done something like this before? The only clues I have found online is that someone suggested extending camel-swagger-java to achieve this. A kick in the direction of how to do that will also be welcome
>
> Holding thumbs!
>
> Thanks
> Riaan
>
>
> Sent from Mail for Windows 10
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2