mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Change function name to be less technically specific
This commit is contained in:
parent
fd72d79ad3
commit
48ce5f36cf
@ -30,5 +30,5 @@ interface AccessTokenEntityInterface extends TokenInterface
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getResponseString(CryptKey $privateKey);
|
public function convertToAccessToken(CryptKey $privateKey);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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(),
|
||||||
|
@ -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) {
|
||||||
|
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user