From 122f61a603bfc4781131078745b5aad35f860555 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 25 Oct 2024 12:50:25 +0000 Subject: [PATCH] Issue 14478: Improved logging --- src/Module/OAuth/Authorize.php | 5 +++-- src/Security/OAuth.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Module/OAuth/Authorize.php b/src/Module/OAuth/Authorize.php index 266f00402e..cd7b274ba6 100644 --- a/src/Module/OAuth/Authorize.php +++ b/src/Module/OAuth/Authorize.php @@ -36,17 +36,18 @@ class Authorize extends BaseApi ], $request); if ($request['response_type'] != 'code') { - Logger::warning('Unsupported or missing response type', ['request' => $_REQUEST]); + Logger::warning('Unsupported or missing response type', ['request' => $request]); $this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity($this->t('Unsupported or missing response type'))); } if (empty($request['client_id']) || empty($request['redirect_uri'])) { - Logger::warning('Incomplete request data', ['request' => $_REQUEST]); + Logger::warning('Incomplete request data', ['request' => $request]); $this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity($this->t('Incomplete request data'))); } $application = OAuth::getApplication($request['client_id'], $request['client_secret'], $request['redirect_uri']); if (empty($application)) { + Logger::warning('An application could not be fetched.', ['request' => $request]); $this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity()); } diff --git a/src/Security/OAuth.php b/src/Security/OAuth.php index a24bb0e8d0..2add1ce584 100644 --- a/src/Security/OAuth.php +++ b/src/Security/OAuth.php @@ -131,6 +131,7 @@ class OAuth // The redirect_uri could contain several URI that are separated by spaces. if (($application['redirect_uri'] != $redirect_uri) && !in_array($redirect_uri, explode(' ', $application['redirect_uri']))) { + Logger::warning('Redirection uri does not match', ['redirect_uri' => $redirect_uri, 'application-redirect_uri' => $application['redirect_uri']]); return []; }