diff --git a/src/Repositories/AccessTokenRepositoryInterface.php b/src/Repositories/AccessTokenRepositoryInterface.php index 26ccb5a6..f39351ff 100644 --- a/src/Repositories/AccessTokenRepositoryInterface.php +++ b/src/Repositories/AccessTokenRepositoryInterface.php @@ -12,31 +12,12 @@ namespace League\OAuth2\Server\Repositories; use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface; -use League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface; /** * Access token interface */ interface AccessTokenRepositoryInterface extends RepositoryInterface { - /** - * Get an instance of Entity\AccessTokenEntity - * - * @param string $token The access token identifier - * - * @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface - */ - public function getAccessTokenEntityByTokenString($token); - - /** - * Get the scopes for an access token - * - * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $token - * - * @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[] - */ - public function getScopeEntitiesAssociatedWithAccessToken(AccessTokenEntityInterface $token); - /** * Persists a new access token to permanent storage * @@ -45,20 +26,18 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity); /** - * Associate a scope with an access token + * Revoke an access token * - * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntityInterface - * @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface $scope + * @param string $tokenId */ - public function associateScopeWithAccessToken( - AccessTokenEntityInterface $accessTokenEntityInterface, - ScopeEntityInterface $scope - ); + public function revokeAccessToken($tokenId); /** - * Delete an access token + * Check if the access token has been revoked * - * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken + * @param string $tokenId + * + * @return bool Return true if this token has been revoked */ - public function deleteAccessToken(AccessTokenEntityInterface $accessToken); + public function isAccessTokenRevoked($tokenId); } diff --git a/src/Repositories/RefreshTokenRepositoryInterface.php b/src/Repositories/RefreshTokenRepositoryInterface.php index bf3e2c8e..1ac9a0d1 100644 --- a/src/Repositories/RefreshTokenRepositoryInterface.php +++ b/src/Repositories/RefreshTokenRepositoryInterface.php @@ -18,30 +18,26 @@ use League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface; */ interface RefreshTokenRepositoryInterface extends RepositoryInterface { - /** - * Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity - * - * @param string $token Refresh token string - * - * @return \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface - */ - public function getRefreshTokenEntityByTokenString($token); - /** * Create a new refresh token_name * - * @param string $token - * @param integer $expireTime - * @param string $accessToken - * - * @return \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface + * @param \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface $refreshTokenEntityInterface */ - public function persistNewRefreshTokenEntity($token, $expireTime, $accessToken); + public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntityInterface); /** - * Delete the refresh token + * Revoke the refresh token * - * @param \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface $token + * @param string $tokenId */ - public function deleteRefreshTokenEntity(RefreshTokenEntityInterface $token); + public function revokeRefreshToken($tokenId); + + /** + * Check if the refresh token has been revoked + * + * @param string $tokenId + * + * @return bool Return true if this token has been revoked + */ + public function isRefreshTokenRevoked($tokenId); }