Switching the OAuth2 lib back again

Couldn't handle the fact that the errors were being echoed from the library
and not thrown or at the very least passed back so I could use them.
This commit is contained in:
Josh Sherman 2014-10-19 10:26:15 -04:00
parent 1ef2adae12
commit 11e4fee711
7 changed files with 374 additions and 1 deletions

View file

@ -0,0 +1,26 @@
<?php
namespace Pickles\OAuth2;
use \League\OAuth2\Server\Storage\Adapter;
use \League\OAuth2\Server\Storage\ScopeInterface;
class ScopeStorage extends StorageAdapter implements ScopeInterface
{
public function get($scope, $grant_type = null, $client_id = null)
{
$sql = 'SELECT * FROM oauth_scopes WHERE id = ?;';
$results = $this->db->fetch($sql, [$scope]);
if (count($results) === 0)
{
return null;
}
return (new ScopeEntity($this->server))->hydrate([
'id' => $result[0]['id'],
'description' => $result[0]['description'],
]);
}
}