From ed17b6540ee320e72e163bf9dd8a882a1c961439 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 22 Mar 2016 14:44:39 +0000 Subject: [PATCH] Add additional repository --- examples/src/Repositories/UserRepository.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/src/Repositories/UserRepository.php b/examples/src/Repositories/UserRepository.php index ec930500..257fe754 100644 --- a/examples/src/Repositories/UserRepository.php +++ b/examples/src/Repositories/UserRepository.php @@ -2,25 +2,34 @@ namespace OAuth2ServerExamples\Repositories; +use League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface; use League\OAuth2\Server\Repositories\UserRepositoryInterface; +use OAuth2ServerExamples\Entities\ScopeEntity; use OAuth2ServerExamples\Entities\UserEntity; class UserRepository implements UserRepositoryInterface { + /** * Get a user entity. * - * @param string $username - * @param string $password + * @param string $username + * @param string $password + * @param string $grantType The grant type used + * @param ScopeEntityInterface[] $scopes * * @return \League\OAuth2\Server\Entities\Interfaces\UserEntityInterface */ - public function getUserEntityByUserCredentials($username, $password) + public function getUserEntityByUserCredentials($username, $password, $grantType, array &$scopes) { if ($username === 'alex' && $password === 'whisky') { + $scope = new ScopeEntity(); + $scope->setIdentifier('email'); + $scopes[] = $scope; + return new UserEntity(); } - return; + return null; } }