From 2a18e0cb9a476621708cced3b3089c0c346ffc04 Mon Sep 17 00:00:00 2001
From: Dave Mc Nicoll <dave.mcnicoll@cslsj.qc.ca>
Date: Mon, 27 Nov 2023 13:02:20 -0500
Subject: [PATCH] - Repaired a bad authentiation config

---
 meta/definitions/authorize.php | 4 ++--
 meta/definitions/routes.php    | 4 ++--
 src/Factory/HttpFactory.php    | 2 +-
 src/Lean.php                   | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/definitions/authorize.php b/meta/definitions/authorize.php
index a8a02c7..5fa621b 100644
--- a/meta/definitions/authorize.php
+++ b/meta/definitions/authorize.php
@@ -30,7 +30,7 @@ return [
             return HttpFactory::createJsonResponse($errorData + [
                 'api.error' => "Authorization failed",
                 'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
-            ]);
+            ], 401);
         };
     },
 
@@ -40,7 +40,7 @@ return [
                 'title' => "Authentication failed",
                 'subtitle' => "",
                 'message' => $message,
-            ]));
+            ]), 401);
         };
     },
 ];
\ No newline at end of file
diff --git a/meta/definitions/routes.php b/meta/definitions/routes.php
index 8cae467..e8bfc8b 100644
--- a/meta/definitions/routes.php
+++ b/meta/definitions/routes.php
@@ -50,8 +50,8 @@ return [
     ],
 
     'app.middlewares' => [
-        HeaderAuthenticationMiddleware::class,
-        PostRequestAuthenticationMiddleware::class,
+        # HeaderAuthenticationMiddleware::class,
+        # PostRequestAuthenticationMiddleware::class,
     ],
 
     'routes.list' => function($c) {
diff --git a/src/Factory/HttpFactory.php b/src/Factory/HttpFactory.php
index 6f32edc..b4dfa73 100644
--- a/src/Factory/HttpFactory.php
+++ b/src/Factory/HttpFactory.php
@@ -33,7 +33,7 @@ class HttpFactory
         return new EmptyResponse($code, $headers);
     }
 
-    public static function createPdfResponse(\Stringable $binary, int $code = 200, array $headers = []) : ResponseInterface
+    public static function createPdfResponse(\Stringable|string $binary, int $code = 200, array $headers = []) : ResponseInterface
     {
         return new PdfResponse((string) $binary, $code, $headers);
     }
diff --git a/src/Lean.php b/src/Lean.php
index a2d62d8..4baea46 100644
--- a/src/Lean.php
+++ b/src/Lean.php
@@ -154,8 +154,8 @@ class Lean
     {
         $path = dirname(__DIR__) . "/meta/definitions/";
 
-        return array_replace(
-            require($path . "authorize.php"),
+        return array_merge(
+        require($path . "authorize.php"),
             class_exists(\Mcnd\CLI\CliMiddleware::class) ? require($path . "cli.php") : [],
             class_exists(\Cronard\CronardMiddleware::class) ? require($path . "cronard.php") : [],
             require($path . "email.php"),