From 54e6bbd4a6140325f05bda692eeefb1740c0daab Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 27 Jul 2014 17:15:55 +0100 Subject: [PATCH] `expires` isn't part of the spec --- src/Grant/AuthCodeGrant.php | 1 - src/Grant/ClientCredentialsGrant.php | 1 - src/Grant/PasswordGrant.php | 1 - src/Grant/RefreshTokenGrant.php | 1 - src/TokenType/Bearer.php | 1 - tests/unit/Grant/PasswordGrantTest.php | 2 -- tests/unit/Grant/RefreshTokenGrantTest.php | 4 +--- 7 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index 5a9820d6..f1357160 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -218,7 +218,6 @@ class AuthCodeGrant extends AbstractGrant } $this->server->getTokenType()->set('access_token', $accessToken->getId()); - $this->server->getTokenType()->set('expires', $accessToken->getExpireTime()); $this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL()); // Associate a refresh token if set diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index 75c50566..76987609 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -102,7 +102,6 @@ class ClientCredentialsGrant extends AbstractGrant $accessToken->save($this->server->getStorage('access_token')); $this->server->getTokenType()->set('access_token', $accessToken->getId()); - $this->server->getTokenType()->set('expires', $accessToken->getExpireTime()); $this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL()); return $this->server->getTokenType()->generateResponse(); diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index 3af3143e..8c21a848 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -137,7 +137,6 @@ class PasswordGrant extends AbstractGrant } $this->server->getTokenType()->set('access_token', $accessToken->getId()); - $this->server->getTokenType()->set('expires', $accessToken->getExpireTime()); $this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL()); // Associate a refresh token if set diff --git a/src/Grant/RefreshTokenGrant.php b/src/Grant/RefreshTokenGrant.php index 25b01743..61799403 100644 --- a/src/Grant/RefreshTokenGrant.php +++ b/src/Grant/RefreshTokenGrant.php @@ -132,7 +132,6 @@ class RefreshTokenGrant extends AbstractGrant $newAccessToken->save($this->server->getStorage('access_token')); $this->server->getTokenType()->set('access_token', $newAccessToken->getId()); - $this->server->getTokenType()->set('expires', $newAccessToken->getExpireTime()); $this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL()); // Expire the old refresh token diff --git a/src/TokenType/Bearer.php b/src/TokenType/Bearer.php index 3cdfc81f..e6e92a29 100644 --- a/src/TokenType/Bearer.php +++ b/src/TokenType/Bearer.php @@ -23,7 +23,6 @@ class Bearer extends AbstractTokenType implements TokenTypeInterface $return = [ 'access_token' => $this->get('access_token'), 'token_type' => 'Bearer', - 'expires' => $this->get('expires'), 'expires_in' => $this->get('expires_in') ]; diff --git a/tests/unit/Grant/PasswordGrantTest.php b/tests/unit/Grant/PasswordGrantTest.php index e55f013e..c3648d10 100644 --- a/tests/unit/Grant/PasswordGrantTest.php +++ b/tests/unit/Grant/PasswordGrantTest.php @@ -402,7 +402,6 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase $this->assertTrue(array_key_exists('access_token', $response)); $this->assertTrue(array_key_exists('token_type', $response)); $this->assertTrue(array_key_exists('expires_in', $response)); - $this->assertTrue(array_key_exists('expires', $response)); } public function testCompleteFlowRefreshToken() @@ -470,6 +469,5 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase // $this->assertTrue(array_key_exists('refresh_token', $response)); $this->assertTrue(array_key_exists('token_type', $response)); $this->assertTrue(array_key_exists('expires_in', $response)); - $this->assertTrue(array_key_exists('expires', $response)); } } diff --git a/tests/unit/Grant/RefreshTokenGrantTest.php b/tests/unit/Grant/RefreshTokenGrantTest.php index 39dc0e2e..e3330d6d 100644 --- a/tests/unit/Grant/RefreshTokenGrantTest.php +++ b/tests/unit/Grant/RefreshTokenGrantTest.php @@ -11,7 +11,7 @@ use League\OAuth2\Server\Entity\RefreshTokenEntity; use League\OAuth2\Server\AuthorizationServer; use Mockery as M; -class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase +class RefreshTokenGrantTest extends \PHPUnit_Framework_TestCase { public function testSetRefreshTokenTTL() { @@ -212,7 +212,6 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase $this->assertTrue(array_key_exists('refresh_token', $response)); $this->assertTrue(array_key_exists('token_type', $response)); $this->assertTrue(array_key_exists('expires_in', $response)); - $this->assertTrue(array_key_exists('expires', $response)); } public function testCompleteFlowRequestScopes() @@ -284,7 +283,6 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase $this->assertTrue(isset($response['refresh_token'])); $this->assertTrue(isset($response['token_type'])); $this->assertTrue(isset($response['expires_in'])); - $this->assertTrue(isset($response['expires'])); } public function testCompleteFlowRequestScopesInvalid()