Merge pull request #14498 from annando/issue-14478

Issue 14478: Improved logging
This commit is contained in:
Tobias Diekershoff 2024-10-25 17:39:04 +02:00 committed by GitHub
commit 3b6030346f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -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());
}

View file

@ -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 [];
}