Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Basic Auth Support #120

Open
yeryomenkom opened this issue Jan 13, 2017 · 1 comment · May be fixed by #210
Open

Basic Auth Support #120

yeryomenkom opened this issue Jan 13, 2017 · 1 comment · May be fixed by #210

Comments

@yeryomenkom
Copy link

How can I add in the root of generated json file this part?
"securityDefinitions":{ "basic_auth":{ "type":"basic", "name":"basic" } }

@dwickern
Copy link
Contributor

dwickern commented Mar 14, 2017

I had the same issue. You can subclass the SwaggerBaseApiController with your own getResources:

class MyApiController extends SwaggerBaseApiController {
  def getResources = Action {
    request =>
      implicit val requestHeader: RequestHeader = request
      val host = requestHeader.host
      val resourceListing = getResourceListing(host)
      resourceListing.addSecurityDefinition("basic_auth", new BasicAuthDefinition)
      val responseStr = returnXml(request) match {
        case true => toXmlString(resourceListing)
        case false => toJsonString(resourceListing)
      }
      returnValue(request, responseStr)
  }
}

@geetikagupta16 geetikagupta16 linked a pull request Jul 8, 2019 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants