From 3d08051cbbc5186aa20eae3c2a81fbbd97dce9ec Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 17 Jan 2016 14:23:18 +0000 Subject: [PATCH] Removed default wording as there is no override --- src/Middleware/ResourceServerMiddleware.php | 2 +- src/Server.php | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Middleware/ResourceServerMiddleware.php b/src/Middleware/ResourceServerMiddleware.php index b1f26bf2..70711b94 100644 --- a/src/Middleware/ResourceServerMiddleware.php +++ b/src/Middleware/ResourceServerMiddleware.php @@ -40,7 +40,7 @@ class ResourceServerMiddleware return $exception->generateHttpResponse($response); } - $request = $this->server->getDefaultResponseType()->determineAccessTokenInHeader($request); + $request = $this->server->getResponseType()->determineAccessTokenInHeader($request); if ($request->getAttribute('oauth_access_token') === null) { $exception = OAuthServerException::accessDenied('Access token was invalid'); diff --git a/src/Server.php b/src/Server.php index c2d90037..034173cc 100644 --- a/src/Server.php +++ b/src/Server.php @@ -44,7 +44,7 @@ class Server implements EmitterAwareInterface /** * @var ResponseTypeInterface */ - protected $defaultResponseType; + protected $responseType; /** * @var string @@ -87,27 +87,27 @@ class Server implements EmitterAwareInterface $this->clientRepository = $clientRepository; $this->accessTokenRepository = $accessTokenRepository; $this->scopeRepository = $scopeRepository; - $this->defaultResponseType = $responseType; $this->privateKeyPath = $privateKeyPath; $this->publicKeyPath = $publicKeyPath; + $this->responseType = $responseType; } /** - * Get the default token type that grants will return + * Get the token type that grants will return in the HTTP response * * @return ResponseTypeInterface */ - public function getDefaultResponseType() + public function getResponseType() { - if (!$this->defaultResponseType instanceof ResponseTypeInterface) { - $this->defaultResponseType = new BearerTokenResponse( - $this->defaultPrivateKeyPath, - $this->defaultPublicKeyPath, + if (!$this->responseType instanceof ResponseTypeInterface) { + $this->responseType = new BearerTokenResponse( + $this->privateKeyPath, + $this->publicKeyPath, $this->accessTokenRepository ); } - return $this->defaultResponseType; + return $this->responseType; } /** @@ -130,7 +130,7 @@ class Server implements EmitterAwareInterface $this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType; // Set grant response type - $this->grantResponseTypes[$grantType->getIdentifier()] = $this->getDefaultResponseType(); + $this->grantResponseTypes[$grantType->getIdentifier()] = $this->getResponseType(); // Set grant access token TTL $this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;