jtownson / swakka

A Scala library for creating Swagger definitions in a type-safe fashion wth Akka-Http

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Support for Bearer Authentication

GiantToast opened this issue · comments

Add support for bearer authentication as described here:
https://swagger.io/docs/specification/authentication/bearer-authentication/

Thanks for the feedback and sorry for not getting back to you sooner.

Bearer auth is something added to OpenApi 3 while at the moment Swakka is limited to OpenApi 2. Version 3 is coming but there are several new features and I have a new day job.

If you needed to spit out a bearer auth section, you could add a new case class extending net.jtownson.swakka.openapimodel.Security in your application code, alongside a matching JsonProtocol. For a guide, look for usages of, say, net.jtownson.swakka.openapimodel.BasicAuthenticationSecurity in the Swakka codebase.

Depending on the tooling you are using to read your OpenApi files this might work or there might be confusion with a v2/v3 mix. Worth a try.

Meanwhile I will raise a separate request to handle OpenApi 3 in its entirety.

Replaced with #2