mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Abstract CryptKey public methods to the CryptKeyInterface
This commit is contained in:
@@ -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.
|
||||
|
@@ -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())
|
||||
|
Reference in New Issue
Block a user