mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-02-13 22:17:05 +05:30
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
namespace OAuth2ServerExamples\Repositories;
|
|
|
|
use League\OAuth2\Server\Entities\ScopeEntity;
|
|
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface;
|
|
|
|
class ScopeRepository implements ScopeRepositoryInterface
|
|
{
|
|
/**
|
|
* Return information about a scope
|
|
*
|
|
* @param string $scopeIdentifier The scope identifier
|
|
* @param string $grantType The grant type used in the request (default = "null")
|
|
* @param string $clientId The client sending the request (default = "null")
|
|
*
|
|
* @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface
|
|
*/
|
|
public function get($scopeIdentifier, $grantType = null, $clientId = null)
|
|
{
|
|
$scopes = [
|
|
'basic' => [
|
|
'description' => 'Basic details about you'
|
|
],
|
|
'email' => [
|
|
'description' => 'Your email address'
|
|
]
|
|
];
|
|
|
|
if (array_key_exists($scopeIdentifier, $scopes) === false) {
|
|
return null;
|
|
}
|
|
|
|
$scope = new ScopeEntity();
|
|
$scope->setIdentifier($scopeIdentifier);
|
|
|
|
return $scope;
|
|
}
|
|
}
|