2015-04-05 21:11:10 +01:00
|
|
|
<?php
|
2016-02-19 18:09:39 -05:00
|
|
|
|
2015-04-05 21:11:10 +01:00
|
|
|
namespace OAuth2ServerExamples\Repositories;
|
|
|
|
|
2016-04-09 15:25:45 +01:00
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface;
|
2015-04-05 21:11:10 +01:00
|
|
|
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
|
2016-03-22 14:44:39 +00:00
|
|
|
use OAuth2ServerExamples\Entities\ScopeEntity;
|
2015-04-05 21:11:10 +01:00
|
|
|
use OAuth2ServerExamples\Entities\UserEntity;
|
|
|
|
|
|
|
|
class UserRepository implements UserRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
2016-03-24 06:07:20 -04:00
|
|
|
* {@inheritdoc}
|
2015-04-05 21:11:10 +01:00
|
|
|
*/
|
2016-03-22 15:11:20 +00:00
|
|
|
public function getUserEntityByUserCredentials(
|
|
|
|
$username,
|
|
|
|
$password,
|
|
|
|
$grantType,
|
2016-03-24 10:04:15 +00:00
|
|
|
ClientEntityInterface $clientEntity
|
2016-03-22 15:11:20 +00:00
|
|
|
) {
|
2015-11-16 12:58:50 +00:00
|
|
|
if ($username === 'alex' && $password === 'whisky') {
|
2016-03-22 14:44:39 +00:00
|
|
|
$scope = new ScopeEntity();
|
|
|
|
$scope->setIdentifier('email');
|
|
|
|
$scopes[] = $scope;
|
|
|
|
|
2015-11-16 12:58:50 +00:00
|
|
|
return new UserEntity();
|
|
|
|
}
|
|
|
|
|
2016-03-22 10:45:28 -04:00
|
|
|
return;
|
2015-04-05 21:11:10 +01:00
|
|
|
}
|
|
|
|
}
|