Added missing methods

This commit is contained in:
Alex Bilbie 2017-07-01 18:08:49 +01:00
parent 0f73bf0054
commit 850793ab88
4 changed files with 49 additions and 7 deletions

View File

@ -12,6 +12,7 @@ namespace League\OAuth2\Server\AuthorizationValidators;
use Lcobucci\JWT\Parser; use Lcobucci\JWT\Parser;
use Lcobucci\JWT\Signer\Rsa\Sha256; use Lcobucci\JWT\Signer\Rsa\Sha256;
use Lcobucci\JWT\ValidationData; use Lcobucci\JWT\ValidationData;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\CryptTrait; use League\OAuth2\Server\CryptTrait;
use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
@ -26,6 +27,11 @@ class BearerTokenValidator implements AuthorizationValidatorInterface
*/ */
private $accessTokenRepository; private $accessTokenRepository;
/**
* @var \League\OAuth2\Server\CryptKey
*/
protected $publicKey;
/** /**
* @param AccessTokenRepositoryInterface $accessTokenRepository * @param AccessTokenRepositoryInterface $accessTokenRepository
*/ */
@ -34,6 +40,16 @@ class BearerTokenValidator implements AuthorizationValidatorInterface
$this->accessTokenRepository = $accessTokenRepository; $this->accessTokenRepository = $accessTokenRepository;
} }
/**
* Set the private key
*
* @param \League\OAuth2\Server\CryptKey $key
*/
public function setPublicKey(CryptKey $key)
{
$this->publicKey = $key;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -11,6 +11,7 @@
namespace League\OAuth2\Server\Grant; namespace League\OAuth2\Server\Grant;
use League\Event\EmitterAwareTrait; use League\Event\EmitterAwareTrait;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\CryptTrait; use League\OAuth2\Server\CryptTrait;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface; use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\AuthCodeEntityInterface; use League\OAuth2\Server\Entities\AuthCodeEntityInterface;
@ -75,6 +76,11 @@ abstract class AbstractGrant implements GrantTypeInterface
*/ */
protected $refreshTokenTTL; protected $refreshTokenTTL;
/**
* @var \League\OAuth2\Server\CryptKey
*/
protected $privateKey;
/** /**
* @param ClientRepositoryInterface $clientRepository * @param ClientRepositoryInterface $clientRepository
*/ */
@ -131,6 +137,16 @@ abstract class AbstractGrant implements GrantTypeInterface
$this->refreshTokenTTL = $refreshTokenTTL; $this->refreshTokenTTL = $refreshTokenTTL;
} }
/**
* Set the private key
*
* @param \League\OAuth2\Server\CryptKey $key
*/
public function setPrivateKey(CryptKey $key)
{
$this->privateKey = $key;
}
/** /**
* Validate the client. * Validate the client.
* *

View File

@ -126,13 +126,6 @@ interface GrantTypeInterface extends EmitterAwareInterface
*/ */
public function setPrivateKey(CryptKey $privateKey); public function setPrivateKey(CryptKey $privateKey);
/**
* Set the path to the public key.
*
* @param CryptKey $publicKey
*/
public function setPublicKey(CryptKey $publicKey);
/** /**
* Set the encryption key * Set the encryption key
* *

View File

@ -11,6 +11,7 @@
namespace League\OAuth2\Server\ResponseTypes; namespace League\OAuth2\Server\ResponseTypes;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\CryptTrait; use League\OAuth2\Server\CryptTrait;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface; use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface; use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
@ -29,6 +30,11 @@ abstract class AbstractResponseType implements ResponseTypeInterface
*/ */
protected $refreshToken; protected $refreshToken;
/**
* @var CryptKey
*/
protected $privateKey;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -44,4 +50,15 @@ abstract class AbstractResponseType implements ResponseTypeInterface
{ {
$this->refreshToken = $refreshToken; $this->refreshToken = $refreshToken;
} }
/**
* Set the private key
*
* @param \League\OAuth2\Server\CryptKey $key
*/
public function setPrivateKey(CryptKey $key)
{
$this->privateKey = $key;
}
} }