X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSecurity%2FOAuth.php;h=7655398b35118a96fcfbddd3d8e4ec359c25dea4;hb=3f2b0b9422915529a0ea585aa4325b6d2f2f65cd;hp=b3573fd68ff86bec8f6314203f6a96729d8202e4;hpb=ecaed2a8450ab8423b4e5ef60ac9a249be60901a;p=friendica.git diff --git a/src/Security/OAuth.php b/src/Security/OAuth.php index b3573fd68f..7655398b35 100644 --- a/src/Security/OAuth.php +++ b/src/Security/OAuth.php @@ -1,6 +1,6 @@ getScheme() . '://' . $uri->getHost() . $uri->getPath(); + $condition = DBA::mergeConditions($condition, ["`redirect_uri` LIKE ?", '%' . $redirect_uri . '%']); } $application = DBA::selectFirst('application', [], $condition); @@ -126,6 +141,12 @@ class OAuth Logger::warning('Application not found', $condition); return []; } + + // 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']))) { + return []; + } + return $application; } @@ -176,7 +197,8 @@ class OAuth 'write' => (stripos($scope, BaseApi::SCOPE_WRITE) !== false), 'follow' => (stripos($scope, BaseApi::SCOPE_FOLLOW) !== false), 'push' => (stripos($scope, BaseApi::SCOPE_PUSH) !== false), - 'created_at' => DateTimeFormat::utcNow()]; + 'created_at' => DateTimeFormat::utcNow() + ]; foreach ([BaseApi::SCOPE_READ, BaseApi::SCOPE_WRITE, BaseApi::SCOPE_WRITE, BaseApi::SCOPE_PUSH] as $scope) { if ($fields[$scope] && !$application[$scope]) {