PM-00000 "Eliminar los Access y Refresh Token expirados" SOLVED
Issue:
Eliminar los Access y Refresh Token expirados
Cause:
Nuevo requerimiento de funciones
Solution:
Se estan eliminando los Access y Refresh Token expirados al hacer
un request al End-point: POST /{workspace}/oauth2/token
This commit is contained in:
@@ -116,6 +116,12 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
||||
|
||||
public function setAccessToken($access_token, $client_id, $user_id, $expires, $scope = null)
|
||||
{
|
||||
//Delete expired Access and Refresh Token
|
||||
foreach (array($this->config["access_token_table"], $this->config["refresh_token_table"]) as $value) {
|
||||
$stmt = $this->db->prepare(sprintf("DELETE FROM %s WHERE EXPIRES < %s", $value, "'" . date("Y-m-d H:i:s") . "'"));
|
||||
$result = $stmt->execute();
|
||||
}
|
||||
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
@@ -177,10 +183,8 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
||||
$access_token->load($token);
|
||||
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE ACCESS_TOKEN = :token', $this->config['access_token_table']));
|
||||
$stmt->execute(compact('token'));
|
||||
|
||||
$stmt = $this->db->prepare(sprintf("DELETE FROM %s WHERE EXPIRES < %s", $this->config["refresh_token_table"], "'" . date("Y-m-d H:i:s") . "'"));
|
||||
return $stmt->execute(compact('token'));
|
||||
return $stmt->execute(compact("token"));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_UserCredentialsInterface */
|
||||
|
||||
Reference in New Issue
Block a user