From f06354638eae979db8ed72ce0a354a715c148546 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Wed, 11 Dec 2019 14:41:37 +0300 Subject: [PATCH] Disallow to perform oauth2 authentication for applications that have no corresponding type --- api/components/OAuth2/Repositories/ClientRepository.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/components/OAuth2/Repositories/ClientRepository.php b/api/components/OAuth2/Repositories/ClientRepository.php index abc0d43..eeb4bc6 100644 --- a/api/components/OAuth2/Repositories/ClientRepository.php +++ b/api/components/OAuth2/Repositories/ClientRepository.php @@ -37,7 +37,12 @@ class ClientRepository implements ClientRepositoryInterface { } private function findModel(string $id): ?OauthClient { - return OauthClient::findOne(['id' => $id]); + $client = OauthClient::findOne(['id' => $id]); + if ($client === null || $client->type !== OauthClient::TYPE_APPLICATION) { + return null; + } + + return $client; } }