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

34 lines
817 B
PHP
Raw Normal View History

2015-04-05 21:11:10 +01:00
<?php
2016-04-17 13:06:05 +01:00
/**
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
*
* @link https://github.com/thephpleague/oauth2-server
*/
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;
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
*/
public function getUserEntityByUserCredentials(
$username,
$password,
$grantType,
2016-03-24 10:04:15 +00:00
ClientEntityInterface $clientEntity
) {
2015-11-16 12:58:50 +00:00
if ($username === 'alex' && $password === 'whisky') {
return new UserEntity();
}
2016-03-22 10:45:28 -04:00
return;
2015-04-05 21:11:10 +01:00
}
}