oauth2-server/src/Entities/Traits/ClientEntityTrait.php

77 lines
1.1 KiB
PHP
Raw Normal View History

2015-04-05 18:33:25 +05:30
<?php
namespace League\OAuth2\Server\Entities\Traits;
trait ClientEntityTrait
{
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $secret;
/**
* @var string
*/
protected $redirectUri;
/**
* @inheritdoc
2015-04-05 18:33:25 +05:30
*/
public function getName()
{
return $this->name;
}
/**
* @inheritdoc
2015-04-05 18:33:25 +05:30
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @inheritdoc
*/
public function canKeepASecret()
{
2016-02-18 17:37:36 +05:30
return $this->secret !== null;
}
/**
* @inheritdoc
*/
public function setSecret($secret)
{
$this->secret = $secret;
}
/**
* @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;
}
}