mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
32 lines
775 B
PHP
32 lines
775 B
PHP
<?php
|
|
|
|
namespace OAuth2ServerExamples\Repositories;
|
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface;
|
|
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
|
|
use OAuth2ServerExamples\Entities\ScopeEntity;
|
|
use OAuth2ServerExamples\Entities\UserEntity;
|
|
|
|
class UserRepository implements UserRepositoryInterface
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getUserEntityByUserCredentials(
|
|
$username,
|
|
$password,
|
|
$grantType,
|
|
ClientEntityInterface $clientEntity
|
|
) {
|
|
if ($username === 'alex' && $password === 'whisky') {
|
|
$scope = new ScopeEntity();
|
|
$scope->setIdentifier('email');
|
|
$scopes[] = $scope;
|
|
|
|
return new UserEntity();
|
|
}
|
|
|
|
return;
|
|
}
|
|
}
|