Skip to content

Commit

Permalink
Added: JWT security scheme to openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninos committed Nov 27, 2023
1 parent 3b02f52 commit 1e82b22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions OpenApi/OpenApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ public function __invoke(array $context = []): OpenApi
{
$openApi = ($this->decorated)($context);

$openApi
->getComponents()->getSecuritySchemes()->offsetSet(
'JWT',
new \ArrayObject([
'type' => 'http',
'scheme' => 'bearer',
'bearerFormat' => 'JWT',
]
)
);

$openApi
->getPaths()
->addPath($this->checkPath, (new PathItem())->withPost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ public function testCheckOpenApiExportCommand()
"requestBodies": {},
"responses": {},
"schemas": {},
"securitySchemes": {}
"securitySchemes": {
"JWT": {
"bearerFormat": "JWT",
"scheme": "bearer",
"type": "http"
}
}
},
"security": [],
"tags": []
Expand Down

0 comments on commit 1e82b22

Please sign in to comment.