mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented features to revoke access for previously authorized OAuth 2.0 clients
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user