oauth2-server/tests/resource/database_mock.php
2012-08-23 12:22:16 +01:00

29 lines
570 B
PHP

<?php
use Oauth2\Resource\Server;
class ResourceDB implements Database
{
private $accessTokens = array('test12345' => array(
'id' => 1,
'owner_type' => 'user',
'owner_id' => 123
));
private $sessionScopes = array(
1 => array(
'foo',
'bar'
)
);
public function validateAccessToken($accessToken)
{
return (isset($this->accessTokens[$accessToken])) ? $this->accessTokens[$accessToken] : false;
}
public function sessionScopes($sessionId)
{
return (isset($this->sessionScopes[$sessionId])) ? $this->sessionScopes[$sessionId] : array();
}
}