Inject server into tokentype

This commit is contained in:
Alex Bilbie 2014-09-30 22:26:34 +01:00
parent b68a5c2abb
commit 1e3a192920
2 changed files with 17 additions and 0 deletions

View File

@ -125,6 +125,7 @@ abstract class AbstractServer
*/ */
public function setTokenType(TokenTypeInterface $tokenType) public function setTokenType(TokenTypeInterface $tokenType)
{ {
$tokenType->setServer($this);
$this->tokenType = $tokenType; $this->tokenType = $tokenType;
} }

View File

@ -12,6 +12,7 @@
namespace League\OAuth2\Server\TokenType; namespace League\OAuth2\Server\TokenType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use League\OAuth2\Server\AbstractServer;
abstract class AbstractTokenType abstract class AbstractTokenType
{ {
@ -22,6 +23,21 @@ abstract class AbstractTokenType
protected $response = []; protected $response = [];
/** /**
* Server
* @var \League\OAuth2\Server\AbstractServer $server
*/
protected $server;
/**
* Set the server
* @param \League\OAuth2\Server\AbstractServer $server
*/
public function setServer(AbstractServer $server)
{
$this->server = $server;
return $this;
}
* Set a key/value response pair * Set a key/value response pair
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value