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