diff --git a/examples/relational/Storage/AccessTokenStorage.php b/examples/relational/Storage/AccessTokenStorage.php index cb81c2ff..faccb46c 100644 --- a/examples/relational/Storage/AccessTokenStorage.php +++ b/examples/relational/Storage/AccessTokenStorage.php @@ -90,6 +90,8 @@ class AccessTokenStorage extends Adapter implements AccessTokenInterface */ public function delete(AbstractTokenEntity $token) { - die(var_dump(__METHOD__, func_get_args())); + Capsule::table('oauth_access_token_scopes') + ->where('access_token', $token->getId()) + ->delete(); } } diff --git a/examples/relational/Storage/RefreshTokenStorage.php b/examples/relational/Storage/RefreshTokenStorage.php index 8022cc8b..ab291802 100644 --- a/examples/relational/Storage/RefreshTokenStorage.php +++ b/examples/relational/Storage/RefreshTokenStorage.php @@ -15,7 +15,21 @@ class RefreshTokenStorage extends Adapter implements RefreshTokenInterface */ public function get($token) { - die(var_dump(__METHOD__, func_get_args())); + $result = Capsule::table('oauth_refresh_tokens') + ->where('refresh_token', $token) + ->where('expire_time', '>=', time()) + ->get(); + + if (count($result) === 1) { + $token = (new RefreshTokenEntity($this->server)) + ->setId($result[0]['refresh_token']) + ->setExpireTime($result[0]['expire_time']) + ->setAccessTokenId($result[0]['access_token']); + + return $token; + } + + return null; } /** @@ -36,7 +50,9 @@ class RefreshTokenStorage extends Adapter implements RefreshTokenInterface */ public function delete(RefreshTokenEntity $token) { - die(var_dump(__METHOD__, func_get_args())); + Capsule::table('oauth_refresh_tokens') + ->where('refresh_token', $token->getId()) + ->delete(); } }