From 84a785d4c9764ca8f625300c2260e031c3c54c07 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Fri, 3 Oct 2014 07:30:10 -0400 Subject: [PATCH] Added Basic Auth functionality --- src/Resource.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Resource.php b/src/Resource.php index 0539031..91b21e5 100644 --- a/src/Resource.php +++ b/src/Resource.php @@ -103,16 +103,17 @@ class Resource extends Object throw new \Exception('Authentication is not configured properly.', 401); } - /* // This class should be in the classes directory of the service - $auth = '\\' . $this->config['pickles']['namespace'] . '\\Auth'; - var_dump($auth); + $auth = '\\' . $this->config['pickles']['namespace'] . '\\Classes\\Auth'; $auth = new $auth(); switch ($this->config['pickles']['auth']) { case 'basic': - $auth->basic(); + if (!$auth->basic()) + { + throw new \Exception('Invalid authentication credentials.', 401); + } break; case 'oauth2': @@ -123,7 +124,6 @@ class Resource extends Object throw new \Exception('Invalid authentication scheme.', 401); break; } - */ } // Hack together some new globals