Added Basic Auth functionality
This commit is contained in:
parent
89fc175701
commit
84a785d4c9
1 changed files with 5 additions and 5 deletions
|
@ -103,16 +103,17 @@ class Resource extends Object
|
||||||
throw new \Exception('Authentication is not configured properly.', 401);
|
throw new \Exception('Authentication is not configured properly.', 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// This class should be in the classes directory of the service
|
// This class should be in the classes directory of the service
|
||||||
$auth = '\\' . $this->config['pickles']['namespace'] . '\\Auth';
|
$auth = '\\' . $this->config['pickles']['namespace'] . '\\Classes\\Auth';
|
||||||
var_dump($auth);
|
|
||||||
$auth = new $auth();
|
$auth = new $auth();
|
||||||
|
|
||||||
switch ($this->config['pickles']['auth'])
|
switch ($this->config['pickles']['auth'])
|
||||||
{
|
{
|
||||||
case 'basic':
|
case 'basic':
|
||||||
$auth->basic();
|
if (!$auth->basic())
|
||||||
|
{
|
||||||
|
throw new \Exception('Invalid authentication credentials.', 401);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oauth2':
|
case 'oauth2':
|
||||||
|
@ -123,7 +124,6 @@ class Resource extends Object
|
||||||
throw new \Exception('Invalid authentication scheme.', 401);
|
throw new \Exception('Invalid authentication scheme.', 401);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack together some new globals
|
// Hack together some new globals
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue