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

26 lines
632 B
PHP
Raw Normal View History

2015-04-05 21:11:10 +01:00
<?php
namespace OAuth2ServerExamples\Repositories;
use League\OAuth2\Server\Repositories\UserRepositoryInterface;
use OAuth2ServerExamples\Entities\UserEntity;
class UserRepository implements UserRepositoryInterface
{
/**
2015-11-16 12:58:50 +00: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();
}
return null;
2015-04-05 21:11:10 +01:00
}
}