diff --git a/src/Entities/AccessTokenEntityInterface.php b/src/Entities/AccessTokenEntityInterface.php index c30a51f9..3849512c 100644 --- a/src/Entities/AccessTokenEntityInterface.php +++ b/src/Entities/AccessTokenEntityInterface.php @@ -30,5 +30,5 @@ interface AccessTokenEntityInterface extends TokenInterface * * @return string */ - public function getResponseString(CryptKey $privateKey); + public function convertToAccessToken(CryptKey $privateKey); } diff --git a/src/Entities/Traits/AccessTokenTrait.php b/src/Entities/Traits/AccessTokenTrait.php index 71b87732..08231784 100644 --- a/src/Entities/Traits/AccessTokenTrait.php +++ b/src/Entities/Traits/AccessTokenTrait.php @@ -47,7 +47,7 @@ trait AccessTokenTrait * * @return string */ - public function getResponseString(CryptKey $privateKey) + public function convertToAccessToken(CryptKey $privateKey) { return (string) $this->convertToJWT($privateKey); } diff --git a/src/Grant/ImplicitGrant.php b/src/Grant/ImplicitGrant.php index d915f61d..e5504151 100644 --- a/src/Grant/ImplicitGrant.php +++ b/src/Grant/ImplicitGrant.php @@ -216,7 +216,7 @@ class ImplicitGrant extends AbstractAuthorizeGrant $this->makeRedirectUri( $finalRedirectUri, [ - 'access_token' => $accessToken->getResponseString($this->privateKey), + 'access_token' => $accessToken->convertToAccessToken($this->privateKey), 'token_type' => 'Bearer', 'expires_in' => $accessToken->getExpiryDateTime()->getTimestamp() - (new \DateTime())->getTimestamp(), 'state' => $authorizationRequest->getState(), diff --git a/src/ResponseTypes/BearerTokenResponse.php b/src/ResponseTypes/BearerTokenResponse.php index 980965ed..b630685c 100644 --- a/src/ResponseTypes/BearerTokenResponse.php +++ b/src/ResponseTypes/BearerTokenResponse.php @@ -27,7 +27,7 @@ class BearerTokenResponse extends AbstractResponseType $responseParams = [ 'token_type' => 'Bearer', 'expires_in' => $expireDateTime - (new \DateTime())->getTimestamp(), - 'access_token' => $this->accessToken->getResponseString($this->privateKey), + 'access_token' => $this->accessToken->convertToAccessToken($this->privateKey), ]; if ($this->refreshToken instanceof RefreshTokenEntityInterface) { diff --git a/tests/Middleware/ResourceServerMiddlewareTest.php b/tests/Middleware/ResourceServerMiddlewareTest.php index dbb507e2..0db71cdd 100644 --- a/tests/Middleware/ResourceServerMiddlewareTest.php +++ b/tests/Middleware/ResourceServerMiddlewareTest.php @@ -30,7 +30,7 @@ class ResourceServerMiddlewareTest extends TestCase $accessToken->setExpiryDateTime((new \DateTime())->add(new \DateInterval('PT1H'))); $accessToken->setClient($client); - $token = $accessToken->getResponseString(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key')); + $token = $accessToken->convertToAccessToken(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key')); $request = new ServerRequest(); $request = $request->withHeader('authorization', sprintf('Bearer %s', $token)); @@ -65,7 +65,7 @@ class ResourceServerMiddlewareTest extends TestCase $accessToken->setExpiryDateTime((new \DateTime())->sub(new \DateInterval('PT1H'))); $accessToken->setClient($client); - $token = $accessToken->getResponseString(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key')); + $token = $accessToken->convertToAccessToken(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key')); $request = new ServerRequest(); $request = $request->withHeader('authorization', sprintf('Bearer %s', $token));