Implemented features to revoke access for previously authorized OAuth 2.0 clients

This commit is contained in:
ErickSkrauch
2020-09-30 20:30:04 +03:00
parent 2a4f29801d
commit b904d5d314
12 changed files with 240 additions and 34 deletions

View File

@ -223,6 +223,10 @@ class OauthProcess {
return false;
}
if ($session->isRevoked()) {
return false;
}
return empty(array_diff($this->getScopesList($request), $session->getScopes()));
}
@ -235,6 +239,7 @@ class OauthProcess {
}
$session->scopes = array_unique(array_merge($session->getScopes(), $this->getScopesList($request)));
$session->last_used_at = time();
Assert::true($session->save());
}
@ -346,7 +351,6 @@ class OauthProcess {
}
private function findOauthSession(Account $account, OauthClient $client): ?OauthSession {
/** @noinspection PhpIncompatibleReturnTypeInspection */
return $account->getOauthSessions()->andWhere(['client_id' => $client->id])->one();
}