mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
86 lines
1.4 KiB
PHP
86 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace OAuth2ServerExamples\Entities;
|
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface;
|
|
use League\OAuth2\Server\Entities\Traits\EntityTrait;
|
|
|
|
class ClientEntity implements ClientEntityInterface
|
|
{
|
|
use EntityTrait;
|
|
|
|
private $name;
|
|
|
|
private $secret;
|
|
|
|
private $redirectUri;
|
|
|
|
/**
|
|
* Get the client's name.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* Set the client's name.
|
|
*
|
|
* @param string $name
|
|
*/
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
}
|
|
|
|
/**
|
|
* @param string $secret
|
|
*/
|
|
public function setSecret($secret)
|
|
{
|
|
$this->secret = $secret;
|
|
}
|
|
|
|
/**
|
|
* Get the hashed client secret
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getSecret()
|
|
{
|
|
return $this->secret;
|
|
}
|
|
|
|
/**
|
|
* Set the client's redirect uri.
|
|
*
|
|
* @param string $redirectUri
|
|
*/
|
|
public function setRedirectUri($redirectUri)
|
|
{
|
|
$this->redirectUri = $redirectUri;
|
|
}
|
|
|
|
/**
|
|
* Returns the registered redirect URI.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getRedirectUri()
|
|
{
|
|
return $this->redirectUri;
|
|
}
|
|
|
|
/**
|
|
* Returns true if the client is capable of keeping it's secrets secret.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function canKeepASecret()
|
|
{
|
|
return $this->secret !== null;
|
|
}
|
|
}
|