Code coverage improvements in grant classes

This commit is contained in:
Alex Bilbie 2014-11-23 23:32:50 +00:00
parent 6157bd77ca
commit e1c0ff2685
4 changed files with 20 additions and 40 deletions

View File

@ -166,21 +166,16 @@ class AuthCodeGrant extends AbstractGrant
public function completeFlow()
{
// Get the required params
$clientId = $this->server->getRequest()->request->get('client_id', null);
if (is_null($clientId)) {
$clientId = $this->server->getRequest()->getUser();
$clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser());
if (is_null($clientId)) {
throw new Exception\InvalidRequestException('client_id');
}
}
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
if (is_null($clientSecret)) {
$clientSecret = $this->server->getRequest()->getPassword();
$clientSecret = $this->server->getRequest()->request->get('client_secret',
$this->server->getRequest()->getPassword());
if (is_null($clientSecret)) {
throw new Exception\InvalidRequestException('client_secret');
}
}
$redirectUri = $this->server->getRequest()->request->get('redirect_uri', null);
if (is_null($redirectUri)) {

View File

@ -55,21 +55,16 @@ class ClientCredentialsGrant extends AbstractGrant
public function completeFlow()
{
// Get the required params
$clientId = $this->server->getRequest()->request->get('client_id', null);
if (is_null($clientId)) {
$clientId = $this->server->getRequest()->getUser();
$clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser());
if (is_null($clientId)) {
throw new Exception\InvalidRequestException('client_id');
}
}
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
if (is_null($clientSecret)) {
$clientSecret = $this->server->getRequest()->getPassword();
$clientSecret = $this->server->getRequest()->request->get('client_secret',
$this->server->getRequest()->getPassword());
if (is_null($clientSecret)) {
throw new Exception\InvalidRequestException('client_secret');
}
}
// Validate client ID and client secret
$client = $this->server->getClientStorage()->get(

View File

@ -80,21 +80,16 @@ class PasswordGrant extends AbstractGrant
public function completeFlow()
{
// Get the required params
$clientId = $this->server->getRequest()->request->get('client_id', null);
if (is_null($clientId)) {
$clientId = $this->server->getRequest()->getUser();
$clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser());
if (is_null($clientId)) {
throw new Exception\InvalidRequestException('client_id');
}
}
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
if (is_null($clientSecret)) {
$clientSecret = $this->server->getRequest()->getPassword();
$clientSecret = $this->server->getRequest()->request->get('client_secret',
$this->server->getRequest()->getPassword());
if (is_null($clientSecret)) {
throw new Exception\InvalidRequestException('client_secret');
}
}
// Validate client ID and client secret
$client = $this->server->getClientStorage()->get(

View File

@ -58,21 +58,16 @@ class RefreshTokenGrant extends AbstractGrant
*/
public function completeFlow()
{
$clientId = $this->server->getRequest()->request->get('client_id', null);
if (is_null($clientId)) {
$clientId = $this->server->getRequest()->getUser();
$clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser());
if (is_null($clientId)) {
throw new Exception\InvalidRequestException('client_id');
}
}
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
if (is_null($clientSecret)) {
$clientSecret = $this->server->getRequest()->getPassword();
$clientSecret = $this->server->getRequest()->request->get('client_secret',
$this->server->getRequest()->getPassword());
if (is_null($clientSecret)) {
throw new Exception\InvalidRequestException('client_secret');
}
}
// Validate client ID and client secret
$client = $this->server->getClientStorage()->get(