oauth2-server/examples/src/Repositories/UserRepository.php

27 lines
629 B
PHP
Raw Normal View History

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;
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
use OAuth2ServerExamples\Entities\UserEntity;
class UserRepository implements UserRepositoryInterface
{
/**
2016-02-19 18:09:39 -05:00
* Get a user entity.
2015-04-05 21:11:10 +01:00
*
* @param string $username
* @param string $password
*
2015-11-16 12:58:50 +00:00
* @return \League\OAuth2\Server\Entities\Interfaces\UserEntityInterface
2015-04-05 21:11:10 +01:00
*/
2015-11-16 12:58:50 +00:00
public function getUserEntityByUserCredentials($username, $password)
2015-04-05 21:11:10 +01:00
{
2015-11-16 12:58:50 +00:00
if ($username === 'alex' && $password === 'whisky') {
return new UserEntity();
}
2016-02-19 18:09:39 -05:00
return;
2015-04-05 21:11:10 +01:00
}
}