Change function name to be less technically specific

This commit is contained in:
Andrew Millington 2018-03-31 10:45:15 +01:00 committed by Lukáš Unger
parent fd72d79ad3
commit 48ce5f36cf
No known key found for this signature in database
GPG Key ID: 48E84B8B7A223C26
5 changed files with 6 additions and 6 deletions

View File

@ -30,5 +30,5 @@ interface AccessTokenEntityInterface extends TokenInterface
* *
* @return string * @return string
*/ */
public function getResponseString(CryptKey $privateKey); public function convertToAccessToken(CryptKey $privateKey);
} }

View File

@ -47,7 +47,7 @@ trait AccessTokenTrait
* *
* @return string * @return string
*/ */
public function getResponseString(CryptKey $privateKey) public function convertToAccessToken(CryptKey $privateKey)
{ {
return (string) $this->convertToJWT($privateKey); return (string) $this->convertToJWT($privateKey);
} }

View File

@ -216,7 +216,7 @@ class ImplicitGrant extends AbstractAuthorizeGrant
$this->makeRedirectUri( $this->makeRedirectUri(
$finalRedirectUri, $finalRedirectUri,
[ [
'access_token' => $accessToken->getResponseString($this->privateKey), 'access_token' => $accessToken->convertToAccessToken($this->privateKey),
'token_type' => 'Bearer', 'token_type' => 'Bearer',
'expires_in' => $accessToken->getExpiryDateTime()->getTimestamp() - (new \DateTime())->getTimestamp(), 'expires_in' => $accessToken->getExpiryDateTime()->getTimestamp() - (new \DateTime())->getTimestamp(),
'state' => $authorizationRequest->getState(), 'state' => $authorizationRequest->getState(),

View File

@ -27,7 +27,7 @@ class BearerTokenResponse extends AbstractResponseType
$responseParams = [ $responseParams = [
'token_type' => 'Bearer', 'token_type' => 'Bearer',
'expires_in' => $expireDateTime - (new \DateTime())->getTimestamp(), '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) { if ($this->refreshToken instanceof RefreshTokenEntityInterface) {

View File

@ -30,7 +30,7 @@ class ResourceServerMiddlewareTest extends TestCase
$accessToken->setExpiryDateTime((new \DateTime())->add(new \DateInterval('PT1H'))); $accessToken->setExpiryDateTime((new \DateTime())->add(new \DateInterval('PT1H')));
$accessToken->setClient($client); $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 = new ServerRequest();
$request = $request->withHeader('authorization', sprintf('Bearer %s', $token)); $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->setExpiryDateTime((new \DateTime())->sub(new \DateInterval('PT1H')));
$accessToken->setClient($client); $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 = new ServerRequest();
$request = $request->withHeader('authorization', sprintf('Bearer %s', $token)); $request = $request->withHeader('authorization', sprintf('Bearer %s', $token));