@@ -7590,7 +7590,6 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
75907590 use Psr \Http \Message \ResponseInterface ;
75917591 use Psr \Http \Message \ServerRequestInterface ;
75927592 use Psr \Http \Server \RequestHandlerInterface ;
7593- use Tqdev \PhpCrudApi \Controller \Responder ;
75947593 use Tqdev \PhpCrudApi \Middleware \Base \Middleware ;
75957594 use Tqdev \PhpCrudApi \Record \ErrorCode ;
75967595 use Tqdev \PhpCrudApi \RequestUtils ;
@@ -7616,7 +7615,7 @@ private function getVerifiedClaims(string $token, int $time, int $leeway, int $t
76167615 if (isset ($ header ['kid ' ])) {
76177616 $ kid = $ header ['kid ' ];
76187617 }
7619- if (!$ secrets [$ kid ]) {
7618+ if (!isset ( $ secrets [$ kid ]) ) {
76207619 return array ();
76217620 }
76227621 $ secret = $ secrets [$ kid ];
@@ -7684,14 +7683,14 @@ private function getClaims(string $token): array
76847683 $ leeway = (int ) $ this ->getProperty ('leeway ' , '5 ' );
76857684 $ ttl = (int ) $ this ->getProperty ('ttl ' , '30 ' );
76867685 $ secrets = $ this ->getMapProperty ('secrets ' , '' );
7686+ if (!$ secrets ) {
7687+ $ secrets = [$ this ->getProperty ('secret ' , '' )];
7688+ }
76877689 $ requirements = array (
76887690 'alg ' => $ this ->getArrayProperty ('algorithms ' , '' ),
76897691 'aud ' => $ this ->getArrayProperty ('audiences ' , '' ),
76907692 'iss ' => $ this ->getArrayProperty ('issuers ' , '' ),
76917693 );
7692- if (!$ secrets ) {
7693- return array ();
7694- }
76957694 return $ this ->getVerifiedClaims ($ token , $ time , $ leeway , $ ttl , $ secrets , $ requirements );
76967695 }
76977696
@@ -8178,12 +8177,17 @@ class OpenApiBuilder
81788177 private $ openapi ;
81798178 private $ records ;
81808179 private $ columns ;
8180+ private $ builders ;
81818181
8182- public function __construct (ReflectionService $ reflection , array $ base , array $ controllers )
8182+ public function __construct (ReflectionService $ reflection , array $ base , array $ controllers, array $ builders )
81838183 {
81848184 $ this ->openapi = new OpenApiDefinition ($ base );
81858185 $ this ->records = in_array ('records ' , $ controllers ) ? new OpenApiRecordsBuilder ($ this ->openapi , $ reflection ) : null ;
81868186 $ this ->columns = in_array ('columns ' , $ controllers ) ? new OpenApiColumnsBuilder ($ this ->openapi ) : null ;
8187+ $ this ->builders = array ();
8188+ foreach ($ builders as $ className ) {
8189+ $ this ->builders [] = new $ className ($ this ->openapi , $ reflection );
8190+ }
81878191 }
81888192
81898193 private function getServerUrl (): string
@@ -8208,6 +8212,9 @@ public function build(): OpenApiDefinition
82088212 if ($ this ->columns ) {
82098213 $ this ->columns ->build ();
82108214 }
8215+ foreach ($ this ->builders as $ builder ) {
8216+ $ builder ->build ();
8217+ }
82118218 return $ this ->openapi ;
82128219 }
82138220 }
@@ -8216,8 +8223,6 @@ public function build(): OpenApiDefinition
82168223// file: src/Tqdev/PhpCrudApi/OpenApi/OpenApiColumnsBuilder.php
82178224namespace Tqdev \PhpCrudApi \OpenApi {
82188225
8219- use Tqdev \PhpCrudApi \Column \ReflectionService ;
8220- use Tqdev \PhpCrudApi \Middleware \Communication \VariableStore ;
82218226 use Tqdev \PhpCrudApi \OpenApi \OpenApiDefinition ;
82228227
82238228 class OpenApiColumnsBuilder
@@ -8786,9 +8791,9 @@ class OpenApiService
87868791 {
87878792 private $ builder ;
87888793
8789- public function __construct (ReflectionService $ reflection , array $ base , array $ controllers )
8794+ public function __construct (ReflectionService $ reflection , array $ base , array $ controllers, array $ customBuilders )
87908795 {
8791- $ this ->builder = new OpenApiBuilder ($ reflection , $ base , $ controllers );
8796+ $ this ->builder = new OpenApiBuilder ($ reflection , $ base , $ controllers, $ customBuilders );
87928797 }
87938798
87948799 public function get (): OpenApiDefinition
@@ -10078,7 +10083,7 @@ public function __construct(Config $config)
1007810083 new CacheController ($ router , $ responder , $ cache );
1007910084 break ;
1008010085 case 'openapi ' :
10081- $ openApi = new OpenApiService ($ reflection , $ config ->getOpenApiBase (), $ config ->getControllers ());
10086+ $ openApi = new OpenApiService ($ reflection , $ config ->getOpenApiBase (), $ config ->getControllers (), $ config -> getCustomOpenApiBuilders () );
1008210087 new OpenApiController ($ router , $ responder , $ openApi );
1008310088 break ;
1008410089 case 'geojson ' :
@@ -10182,6 +10187,7 @@ class Config
1018210187 'middlewares ' => 'cors ' ,
1018310188 'controllers ' => 'records,geojson,openapi ' ,
1018410189 'customControllers ' => '' ,
10190+ 'customOpenApiBuilders ' => '' ,
1018510191 'cacheType ' => 'TempFile ' ,
1018610192 'cachePath ' => '' ,
1018710193 'cacheTime ' => 10 ,
@@ -10314,6 +10320,11 @@ public function getCustomControllers(): array
1031410320 return array_filter (array_map ('trim ' , explode (', ' , $ this ->values ['customControllers ' ])));
1031510321 }
1031610322
10323+ public function getCustomOpenApiBuilders (): array
10324+ {
10325+ return array_filter (array_map ('trim ' , explode (', ' , $ this ->values ['customOpenApiBuilders ' ])));
10326+ }
10327+
1031710328 public function getCacheType (): string
1031810329 {
1031910330 return $ this ->values ['cacheType ' ];
0 commit comments