mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 01:36:02 +05:30
93 lines
1.5 KiB
PHP
93 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace LeagueTests\Stubs;
|
|
|
|
use League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface;
|
|
use League\OAuth2\Server\Entities\Traits\EntityTrait;
|
|
|
|
class ClientEntity implements ClientEntityInterface
|
|
{
|
|
use EntityTrait;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $name;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $secret;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $redirectUri;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function canKeepASecret()
|
|
{
|
|
return $this->secret !== null;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function setSecret($secret)
|
|
{
|
|
$this->secret = password_hash($secret, PASSWORD_DEFAULT);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function validateSecret($submittedSecret)
|
|
{
|
|
return strcmp((string) $submittedSecret, $this->secret) === 0;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function setRedirectUri($redirectUri)
|
|
{
|
|
$this->redirectUri = $redirectUri;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getRedirectUri()
|
|
{
|
|
return $this->redirectUri;
|
|
}
|
|
|
|
/**
|
|
* Get the hashed client secret
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getSecret()
|
|
{
|
|
return $this->secret;
|
|
}
|
|
}
|