Support returning PSR-7 responses in AbstractOauth2Action
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 6 Aug 2021 13:55:13 +0000 (15:55 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 14:29:53 +0000 (16:29 +0200)
wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php

index b837e90b735a53c6fbe9ca27cfa9982e378db801..37136b564b6817da4f3af17f3493a4939f56c3a2 100644 (file)
@@ -7,6 +7,7 @@ use GuzzleHttp\Psr7\Request;
 use ParagonIE\ConstantTime\Base64UrlSafe;
 use ParagonIE\ConstantTime\Hex;
 use Psr\Http\Client\ClientExceptionInterface;
+use Psr\Http\Message\ResponseInterface;
 use wcf\system\exception\NamedUserException;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\io\HttpFactory;
@@ -241,11 +242,15 @@ abstract class AbstractOauth2Action extends AbstractAction
                 $accessToken = $this->codeToAccessToken($_GET['code']);
                 $oauthUser = $this->getUser($accessToken);
 
-                $this->processUser($oauthUser);
+                $result = $this->processUser($oauthUser);
             } elseif (isset($_GET['error'])) {
-                $this->handleError($_GET['error']);
+                $result = $this->handleError($_GET['error']);
             } else {
-                $this->initiate();
+                $result = $this->initiate();
+            }
+
+            if ($result instanceof ResponseInterface) {
+                return $result;
             }
         } catch (NamedUserException | PermissionDeniedException $e) {
             throw $e;