Abstract CryptKey public methods to the CryptKeyInterface

This commit is contained in:
ErickSkrauch
2019-08-17 23:51:23 +03:00
parent 0b0b43d433
commit 4673e7de89
11 changed files with 58 additions and 48 deletions

View File

@@ -9,14 +9,14 @@
namespace League\OAuth2\Server\Entities;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\CryptKeyInterface;
interface AccessTokenEntityInterface extends TokenInterface
{
/**
* Set a private key used to encrypt the access token.
*/
public function setPrivateKey(CryptKey $privateKey);
public function setPrivateKey(CryptKeyInterface $privateKey);
/**
* Generate a string representation of the access token.

View File

@@ -14,21 +14,21 @@ use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Lcobucci\JWT\Token;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\CryptKeyInterface;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Entities\ScopeEntityInterface;
trait AccessTokenTrait
{
/**
* @var CryptKey
* @var CryptKeyInterface
*/
private $privateKey;
/**
* Set the private key used to encrypt this access token.
*/
public function setPrivateKey(CryptKey $privateKey)
public function setPrivateKey(CryptKeyInterface $privateKey)
{
$this->privateKey = $privateKey;
}
@@ -36,11 +36,11 @@ trait AccessTokenTrait
/**
* Generate a JWT from the access token
*
* @param CryptKey $privateKey
* @param CryptKeyInterface $privateKey
*
* @return Token
*/
private function convertToJWT(CryptKey $privateKey)
private function convertToJWT(CryptKeyInterface $privateKey)
{
return (new Builder())
->setAudience($this->getClient()->getIdentifier())