tornado-swagger icon indicating copy to clipboard operation
tornado-swagger copied to clipboard

[Question] Does this tools support jwt authentication?

Open inuyasha82 opened this issue 1 year ago • 0 comments

I was trying to use tornado-swagger, with a jwt token authenticated project.

I tried to follow the auth-server example: https://github.com/mrk-andreev/tornado-swagger/blob/master/examples/auth_server.py

Where the security is specified in the setup_swagger call:

        setup_swagger(
            self._routes,
            swagger_url="/doc",
            api_base_url="/",
            description="",
            api_version="1.0.0",
            title="Journal API",
            contact="name@domain",
            security_definitions={"ApiKeyAuth": {"type": "apiKey", "in": "header", "name": "X-API-Key"}},
            security=[{"ApiKeyAuth": []}],
        )

Since the specs i have on the swagger config are:

"securitySchemes": {
   "JWT": {
     "type": "http",
     "scheme": "bearer",
     "bearerFormat": "<JWT>"
     }
 }

what i tried to do is use these values in the security_definition dict:

           security_definitions={"JWT": {"type": "http", "in": "header", "name": "Authorization"}},
           security=[{"JWT": []}],)

But although i get the authorize button, when i click on it i it shows a message saying

Unknown security definition type http

Is it possible to declare this type of authentication? Or it is not supported?

Thanks!

inuyasha82 avatar Nov 13 '23 16:11 inuyasha82