diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index 8ac69270..e8c5d612 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -166,20 +166,15 @@ class AuthCodeGrant extends AbstractGrant public function completeFlow() { // Get the required params - $clientId = $this->server->getRequest()->request->get('client_id', null); + $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser()); if (is_null($clientId)) { - $clientId = $this->server->getRequest()->getUser(); - if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); - } + throw new Exception\InvalidRequestException('client_id'); } - $clientSecret = $this->server->getRequest()->request->get('client_secret', null); + $clientSecret = $this->server->getRequest()->request->get('client_secret', + $this->server->getRequest()->getPassword()); if (is_null($clientSecret)) { - $clientSecret = $this->server->getRequest()->getPassword(); - if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); - } + throw new Exception\InvalidRequestException('client_secret'); } $redirectUri = $this->server->getRequest()->request->get('redirect_uri', null); diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index 6e937103..21669d9b 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -55,20 +55,15 @@ class ClientCredentialsGrant extends AbstractGrant public function completeFlow() { // Get the required params - $clientId = $this->server->getRequest()->request->get('client_id', null); + $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser()); if (is_null($clientId)) { - $clientId = $this->server->getRequest()->getUser(); - if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); - } + throw new Exception\InvalidRequestException('client_id'); } - $clientSecret = $this->server->getRequest()->request->get('client_secret', null); + $clientSecret = $this->server->getRequest()->request->get('client_secret', + $this->server->getRequest()->getPassword()); if (is_null($clientSecret)) { - $clientSecret = $this->server->getRequest()->getPassword(); - if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); - } + throw new Exception\InvalidRequestException('client_secret'); } // Validate client ID and client secret diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index 496d3ace..8130ade1 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -80,20 +80,15 @@ class PasswordGrant extends AbstractGrant public function completeFlow() { // Get the required params - $clientId = $this->server->getRequest()->request->get('client_id', null); + $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser()); if (is_null($clientId)) { - $clientId = $this->server->getRequest()->getUser(); - if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); - } + throw new Exception\InvalidRequestException('client_id'); } - $clientSecret = $this->server->getRequest()->request->get('client_secret', null); + $clientSecret = $this->server->getRequest()->request->get('client_secret', + $this->server->getRequest()->getPassword()); if (is_null($clientSecret)) { - $clientSecret = $this->server->getRequest()->getPassword(); - if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); - } + throw new Exception\InvalidRequestException('client_secret'); } // Validate client ID and client secret diff --git a/src/Grant/RefreshTokenGrant.php b/src/Grant/RefreshTokenGrant.php index a5e23385..c12c62a9 100644 --- a/src/Grant/RefreshTokenGrant.php +++ b/src/Grant/RefreshTokenGrant.php @@ -58,20 +58,15 @@ class RefreshTokenGrant extends AbstractGrant */ public function completeFlow() { - $clientId = $this->server->getRequest()->request->get('client_id', null); + $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser()); if (is_null($clientId)) { - $clientId = $this->server->getRequest()->getUser(); - if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); - } + throw new Exception\InvalidRequestException('client_id'); } - $clientSecret = $this->server->getRequest()->request->get('client_secret', null); + $clientSecret = $this->server->getRequest()->request->get('client_secret', + $this->server->getRequest()->getPassword()); if (is_null($clientSecret)) { - $clientSecret = $this->server->getRequest()->getPassword(); - if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); - } + throw new Exception\InvalidRequestException('client_secret'); } // Validate client ID and client secret