Removed unused methods

This commit is contained in:
Alex Bilbie 2016-04-17 12:42:42 +01:00
parent 9f3648039b
commit 6205611a71

View File

@ -5,8 +5,6 @@ namespace League\OAuth2\Server;
use DateInterval; use DateInterval;
use League\Event\EmitterAwareInterface; use League\Event\EmitterAwareInterface;
use League\Event\EmitterAwareTrait; use League\Event\EmitterAwareTrait;
use League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface;
use League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator;
use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\GrantTypeInterface; use League\OAuth2\Server\Grant\GrantTypeInterface;
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
@ -62,11 +60,6 @@ class Server implements EmitterAwareInterface
*/ */
private $scopeRepository; private $scopeRepository;
/**
* @var \League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface
*/
private $authorizationValidator;
/** /**
* New server instance. * New server instance.
* *
@ -76,7 +69,6 @@ class Server implements EmitterAwareInterface
* @param \League\OAuth2\Server\CryptKey|string $privateKey * @param \League\OAuth2\Server\CryptKey|string $privateKey
* @param \League\OAuth2\Server\CryptKey|string $publicKey * @param \League\OAuth2\Server\CryptKey|string $publicKey
* @param null|\League\OAuth2\Server\ResponseTypes\ResponseTypeInterface $responseType * @param null|\League\OAuth2\Server\ResponseTypes\ResponseTypeInterface $responseType
* @param null|\League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface $authorizationValidator
*/ */
public function __construct( public function __construct(
ClientRepositoryInterface $clientRepository, ClientRepositoryInterface $clientRepository,
@ -84,8 +76,7 @@ class Server implements EmitterAwareInterface
ScopeRepositoryInterface $scopeRepository, ScopeRepositoryInterface $scopeRepository,
$privateKey, $privateKey,
$publicKey, $publicKey,
ResponseTypeInterface $responseType = null, ResponseTypeInterface $responseType = null
AuthorizationValidatorInterface $authorizationValidator = null
) { ) {
$this->clientRepository = $clientRepository; $this->clientRepository = $clientRepository;
$this->accessTokenRepository = $accessTokenRepository; $this->accessTokenRepository = $accessTokenRepository;
@ -102,7 +93,6 @@ class Server implements EmitterAwareInterface
$this->publicKey = $publicKey; $this->publicKey = $publicKey;
$this->responseType = $responseType; $this->responseType = $responseType;
$this->authorizationValidator = $authorizationValidator;
} }
/** /**
@ -199,20 +189,6 @@ class Server implements EmitterAwareInterface
throw OAuthServerException::unsupportedGrantType(); throw OAuthServerException::unsupportedGrantType();
} }
/**
* Determine the access token validity.
*
* @param \Psr\Http\Message\ServerRequestInterface $request
*
* @throws \League\OAuth2\Server\Exception\OAuthServerException
*
* @return \Psr\Http\Message\ServerRequestInterface
*/
public function validateAuthenticatedRequest(ServerRequestInterface $request)
{
return $this->getAuthorizationValidator()->validateAuthorization($request);
}
/** /**
* Get the token type that grants will return in the HTTP response. * Get the token type that grants will return in the HTTP response.
* *
@ -228,18 +204,4 @@ class Server implements EmitterAwareInterface
return $this->responseType; return $this->responseType;
} }
/**
* @return \League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface
*/
protected function getAuthorizationValidator()
{
if (!$this->authorizationValidator instanceof AuthorizationValidatorInterface) {
$this->authorizationValidator = new BearerTokenValidator($this->accessTokenRepository);
}
$this->authorizationValidator->setPublicKey($this->publicKey);
return $this->authorizationValidator;
}
} }