oauth2-server/tests/resource/database_mock.php

31 lines
581 B
PHP
Raw Normal View History

2012-08-23 16:52:16 +05:30
<?php
use OAuth2\Resource\Database;
2012-08-23 16:52:16 +05:30
class ResourceDB implements Database
{
2012-08-27 18:54:32 +05:30
private $accessTokens = array(
'test12345' => array(
'id' => 1,
'owner_type' => 'user',
'owner_id' => 123
)
);
2012-08-23 16:52:16 +05:30
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();
}
}