mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 09:47:46 +05:30
31 lines
581 B
PHP
31 lines
581 B
PHP
<?php
|
|
|
|
use OAuth2\Resource\Database;
|
|
|
|
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();
|
|
}
|
|
} |