Implemented final storage methods

This commit is contained in:
Alex Bilbie 2014-08-06 08:42:15 +01:00
parent 71ac21b70e
commit 8be92d413d
2 changed files with 21 additions and 3 deletions

View File

@ -90,6 +90,8 @@ class AccessTokenStorage extends Adapter implements AccessTokenInterface
*/ */
public function delete(AbstractTokenEntity $token) public function delete(AbstractTokenEntity $token)
{ {
die(var_dump(__METHOD__, func_get_args())); Capsule::table('oauth_access_token_scopes')
->where('access_token', $token->getId())
->delete();
} }
} }

View File

@ -15,7 +15,21 @@ class RefreshTokenStorage extends Adapter implements RefreshTokenInterface
*/ */
public function get($token) 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) public function delete(RefreshTokenEntity $token)
{ {
die(var_dump(__METHOD__, func_get_args())); Capsule::table('oauth_refresh_tokens')
->where('refresh_token', $token->getId())
->delete();
} }
} }