From 658a959e5da48610a04f083481e41c2646db8d1f Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 10 Apr 2020 17:54:50 -0600 Subject: [PATCH] Fix trailing comma in DaemonAuthenticate.php, change ServerDetailsController.php to use node authentication --- .../Api/Remote/Servers/ServerDetailsController.php | 4 +--- app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php index c60b9e1a..2e4aa8ab 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerDetailsController.php @@ -83,9 +83,7 @@ class ServerDetailsController extends Controller */ public function list(Request $request) { - $authorization = substr($request->header('Authorization'), 7); - - $node = $this->nodeRepository->findFirstWhere(['daemonSecret' => $authorization]); + $node = $request->attributes->get('node'); $servers = $this->repository->loadEveryServerForNode($node->id); $configurations = []; diff --git a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php index 8735c8d2..a2b1e716 100644 --- a/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php +++ b/app/Http/Middleware/Api/Daemon/DaemonAuthenticate.php @@ -69,7 +69,7 @@ class DaemonAuthenticate // Ensure that all of the correct parts are provided in the header. if (count($parts) !== 2 || empty($parts[0]) || empty($parts[1])) { throw new BadRequestHttpException( - 'The Authorization headed provided was not in a valid format.', + 'The Authorization headed provided was not in a valid format.' ); }