Hi


I’m new to Swagger. I’m using Play 2.4 on Java, Swagger Version 2.0, Play 
Swagger Version 1.5.0.  

 I’m stuck with defining my security types in code. 

I can’t seem to find a sample of Play Java code to add Basic 
Authentication. 

The samples I see are in  older threads that are no longer valid. 

 

Looking through the JaXRS sample code, I got so far as to set my swagger 
object

 Swagger swagger = new Swagger().info(info);

  swagger.securityDefinition("basicAuth", new 
io.swagger.models.auth.BasicAuthDefinition());

 But I’m not sure how to update play configuration with the swagger object. 
Not sure if I’m in the  right track. 


For now I generate the swagger.json file and then add the following 
security Definition object manually

 "securityDefinitions" :{

    "basicAuth" : {

      "type" : "basic",

      "description": "HTTP Basic Authentication. Works over `HTTP` and 
`HTTPS`"

    }

  },

But prefer to set this in the code so I don’t have to manually update the 
JSON every time I change code. 


Would appreciate if I can get some help. 


Thanks.

Sugantha. 

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to