From 8bce00cc9be07c4b14ac456f440f2f07f9e6b1eb Mon Sep 17 00:00:00 2001 From: Ninos Date: Fri, 22 Sep 2023 20:46:37 +0200 Subject: [PATCH] Added: JWT security scheme to openapi (adding token in swagger ui without `Bearer ` prefix) --- OpenApi/OpenApiFactory.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenApi/OpenApiFactory.php b/OpenApi/OpenApiFactory.php index 88227fb3..fe792dc7 100644 --- a/OpenApi/OpenApiFactory.php +++ b/OpenApi/OpenApiFactory.php @@ -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(