diff --git a/src/Entities/Interfaces/RefreshTokenEntityInterface.php b/src/Entities/Interfaces/RefreshTokenEntityInterface.php index f6c91b97..a095d4a1 100644 --- a/src/Entities/Interfaces/RefreshTokenEntityInterface.php +++ b/src/Entities/Interfaces/RefreshTokenEntityInterface.php @@ -1,17 +1,42 @@ <?php namespace League\OAuth2\Server\Entities\Interfaces; -interface RefreshTokenEntityInterface extends TokenInterface +interface RefreshTokenEntityInterface { /** - * Set the original access token that the refresh token was associated with + * Get the token's identifier + * @return string + */ + public function getIdentifier(); + + /** + * Set the token's identifier + * @param $identifier + */ + public function setIdentifier($identifier); + + /** + * Get the token's expiry date time + * @return \DateTime + */ + public function getExpiryDateTime(); + + /** + * Set the date time when the token expires + * @param \DateTime $dateTime + */ + public function setExpiryDateTime(\DateTime $dateTime); + + /** + * Set the access token that the refresh token was associated with + * * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken */ - public function setOriginalAccessToken(AccessTokenEntityInterface $accessToken); + public function setAccessToken(AccessTokenEntityInterface $accessToken); /** * Get the access token that the refresh token was originally associated with * @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface */ - public function getOriginalAccessToken(); + public function getAccessToken(); } diff --git a/src/Entities/RefreshTokenEntity.php b/src/Entities/RefreshTokenEntity.php index 8c5ee6fd..1f6c6d07 100644 --- a/src/Entities/RefreshTokenEntity.php +++ b/src/Entities/RefreshTokenEntity.php @@ -12,5 +12,5 @@ use League\OAuth2\Server\Entities\Traits\TokenEntityTrait; */ class RefreshTokenEntity implements RefreshTokenEntityInterface { - use EntityTrait, TokenEntityTrait, RefreshTokenTrait; + use EntityTrait, RefreshTokenTrait; } diff --git a/src/Entities/Traits/RefreshTokenTrait.php b/src/Entities/Traits/RefreshTokenTrait.php index 06f81808..71e39225 100644 --- a/src/Entities/Traits/RefreshTokenTrait.php +++ b/src/Entities/Traits/RefreshTokenTrait.php @@ -1,6 +1,7 @@ <?php namespace League\OAuth2\Server\Entities\Traits; +use DateTime; use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface; trait RefreshTokenTrait @@ -8,23 +9,45 @@ trait RefreshTokenTrait /** * @var AccessTokenEntityInterface */ - protected $originalAccessToken; + protected $accessToken; /** - * Set the original access token that the refresh token was associated with - * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken + * @var DateTime */ - public function setOriginalAccessToken(AccessTokenEntityInterface $accessToken) + protected $expiryDateTime; + + /** + * @inheritdoc + */ + public function setAccessToken(AccessTokenEntityInterface $accessToken) { - $this->originalAccessToken = $accessToken; + $this->accessToken = $accessToken; } /** - * Get the access token that the refresh token was originally associated with - * @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface + * @inheritdoc */ - public function getOriginalAccessToken() + public function getAccessToken() { - return $this->originalAccessToken; + return $this->accessToken; + } + + /** + * Get the token's expiry date time + * @return DateTime + */ + public function getExpiryDateTime() + { + return $this->expiryDateTime; + } + + /** + * Set the date time when the token expires + * + * @param DateTime $dateTime + */ + public function setExpiryDateTime(DateTime $dateTime) + { + $this->expiryDateTime = $dateTime; } } \ No newline at end of file