First commit of new examples

This commit is contained in:
Alex Bilbie
2015-04-05 17:02:43 +01:00
parent f1da0d2943
commit 164de644e9
7 changed files with 1263 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?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;
}
}