mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-24 05:59:48 +05:30
Code coverage improvements in grant classes
This commit is contained in:
parent
6157bd77ca
commit
e1c0ff2685
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user