2015-04-05 18:33:25 +05:30
|
|
|
<?php
|
2016-02-20 04:39:39 +05:30
|
|
|
|
2016-03-15 05:40:47 +05:30
|
|
|
namespace LeagueTests\Stubs;
|
2015-04-05 18:33:25 +05:30
|
|
|
|
2016-04-09 19:55:45 +05:30
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface;
|
2016-03-15 05:40:47 +05:30
|
|
|
use League\OAuth2\Server\Entities\Traits\EntityTrait;
|
|
|
|
|
|
|
|
class ClientEntity implements ClientEntityInterface
|
2015-04-05 18:33:25 +05:30
|
|
|
{
|
2016-03-15 05:40:47 +05:30
|
|
|
use EntityTrait;
|
|
|
|
|
2015-04-05 18:33:25 +05:30
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $name;
|
|
|
|
|
|
|
|
/**
|
2016-02-18 16:18:23 +05:30
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $secret;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $redirectUri;
|
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2015-04-05 18:33:25 +05:30
|
|
|
*/
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2015-04-05 18:33:25 +05:30
|
|
|
*/
|
|
|
|
public function setName($name)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
2016-02-18 16:18:23 +05:30
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2016-02-18 16:18:23 +05:30
|
|
|
*/
|
|
|
|
public function canKeepASecret()
|
|
|
|
{
|
2016-02-18 17:37:36 +05:30
|
|
|
return $this->secret !== null;
|
2016-02-18 16:18:23 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2016-02-18 16:18:23 +05:30
|
|
|
*/
|
|
|
|
public function setSecret($secret)
|
|
|
|
{
|
2016-03-16 02:59:45 +05:30
|
|
|
$this->secret = password_hash($secret, PASSWORD_DEFAULT);
|
2016-02-18 16:18:23 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2016-02-18 16:18:23 +05:30
|
|
|
*/
|
|
|
|
public function validateSecret($submittedSecret)
|
|
|
|
{
|
|
|
|
return strcmp((string) $submittedSecret, $this->secret) === 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2016-02-18 16:18:23 +05:30
|
|
|
*/
|
|
|
|
public function setRedirectUri($redirectUri)
|
|
|
|
{
|
|
|
|
$this->redirectUri = $redirectUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-02-20 04:39:39 +05:30
|
|
|
* {@inheritdoc}
|
2016-02-18 16:18:23 +05:30
|
|
|
*/
|
|
|
|
public function getRedirectUri()
|
|
|
|
{
|
|
|
|
return $this->redirectUri;
|
|
|
|
}
|
2016-03-16 02:59:45 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the hashed client secret
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getSecret()
|
|
|
|
{
|
|
|
|
return $this->secret;
|
|
|
|
}
|
2016-01-20 15:06:16 +05:30
|
|
|
}
|