From 367e78cbf89b9f8710ba04af23d38242a64193fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sat, 8 Apr 2023 21:21:30 +0200 Subject: [PATCH] use name 'oauth_payload' for data received from oauth authentication request --- src/Controller/OAuthLoginController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Controller/OAuthLoginController.php b/src/Controller/OAuthLoginController.php index c0d226a..6bee3b0 100644 --- a/src/Controller/OAuthLoginController.php +++ b/src/Controller/OAuthLoginController.php @@ -36,7 +36,7 @@ class OAuthLoginController return new HtmlContent('oauth/oauth_error', ['error' => 'An invalid request was made. Please start authentication again.']); } - $this->request->session()->set('oauth_state', [ + $this->request->session()->set('oauth_payload', [ 'redirect_uri' => $redirectUri, 'state' => $state, 'nonce' => $nonce === null ? '' : $nonce @@ -49,12 +49,12 @@ class OAuthLoginController public function finishOauth() { - $oauthState = $this->request->session()->get('oauth_state'); - if ($oauthState === null) { + $oAuthPayload = $this->request->session()->get('oauth_payload'); + if ($oAuthPayload === null) { return new HtmlContent('oauth/oauth_error', ['error' => 'An invalid request was made. Please start authentication again.']); } - $this->request->session()->delete('oauth_state'); + $this->request->session()->delete('oauth_payload'); /** * @var ?User $user @@ -67,16 +67,16 @@ class OAuthLoginController $code = bin2hex(random_bytes(16)); $token = new OAuthToken(); - $token->setNonce($oauthState['nonce']); + $token->setNonce($oAuthPayload['nonce']); $token->setUser($user); $token->setCode($code); $token->setCreatedDate(new DateTime()); $token->setExpiresDate(new DateTime('+5 minutes')); $this->pdm->saveToDb($token); - $redirectUri = $oauthState['redirect_uri']; + $redirectUri = $oAuthPayload['redirect_uri']; $additionalUriParams = [ - 'state' => $oauthState['state'], + 'state' => $oAuthPayload['state'], 'code' => $code ]; $and = (strpos($redirectUri, '?') !== false) ? '&' : '?'; -- 2.45.2