mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
allowing client crendentials to be sent as Basic authentication
This commit is contained in:
@ -165,12 +165,18 @@ class AuthCodeGrant extends AbstractGrant
|
|||||||
// Get the required params
|
// Get the required params
|
||||||
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
||||||
if (is_null($clientId)) {
|
if (is_null($clientId)) {
|
||||||
throw new Exception\InvalidRequestException('client_id');
|
$clientId = $this->server->getRequest()->getUser();
|
||||||
|
if (is_null($clientId)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
||||||
if (is_null($clientSecret)) {
|
if (is_null($clientSecret)) {
|
||||||
throw new Exception\InvalidRequestException('client_secret');
|
$clientId = $this->server->getRequest()->getPassword();
|
||||||
|
if (is_null($clientSecret)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_secret');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$redirectUri = $this->server->getRequest()->request->get('redirect_uri', null);
|
$redirectUri = $this->server->getRequest()->request->get('redirect_uri', null);
|
||||||
|
@ -56,12 +56,18 @@ class ClientCredentialsGrant extends AbstractGrant
|
|||||||
// Get the required params
|
// Get the required params
|
||||||
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
||||||
if (is_null($clientId)) {
|
if (is_null($clientId)) {
|
||||||
throw new Exception\InvalidRequestException('client_id');
|
$clientId = $this->server->getRequest()->getUser();
|
||||||
|
if (is_null($clientId)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
||||||
if (is_null($clientSecret)) {
|
if (is_null($clientSecret)) {
|
||||||
throw new Exception\InvalidRequestException('client_secret');
|
$clientId = $this->server->getRequest()->getPassword();
|
||||||
|
if (is_null($clientSecret)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_secret');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and client secret
|
// Validate client ID and client secret
|
||||||
|
@ -80,12 +80,18 @@ class PasswordGrant extends AbstractGrant
|
|||||||
// Get the required params
|
// Get the required params
|
||||||
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
||||||
if (is_null($clientId)) {
|
if (is_null($clientId)) {
|
||||||
throw new Exception\InvalidRequestException('client_id');
|
$clientId = $this->server->getRequest()->getUser();
|
||||||
|
if (is_null($clientId)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
||||||
if (is_null($clientSecret)) {
|
if (is_null($clientSecret)) {
|
||||||
throw new Exception\InvalidRequestException('client_secret');
|
$clientId = $this->server->getRequest()->getPassword();
|
||||||
|
if (is_null($clientSecret)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_secret');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and client secret
|
// Validate client ID and client secret
|
||||||
|
@ -60,12 +60,18 @@ class RefreshTokenGrant extends AbstractGrant
|
|||||||
{
|
{
|
||||||
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
$clientId = $this->server->getRequest()->request->get('client_id', null);
|
||||||
if (is_null($clientId)) {
|
if (is_null($clientId)) {
|
||||||
throw new Exception\InvalidRequestException('client_id');
|
$clientId = $this->server->getRequest()->getUser();
|
||||||
|
if (is_null($clientId)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
$clientSecret = $this->server->getRequest()->request->get('client_secret', null);
|
||||||
if (is_null($clientSecret)) {
|
if (is_null($clientSecret)) {
|
||||||
throw new Exception\InvalidRequestException('client_secret');
|
$clientId = $this->server->getRequest()->getPassword();
|
||||||
|
if (is_null($clientSecret)) {
|
||||||
|
throw new Exception\InvalidRequestException('client_secret');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and client secret
|
// Validate client ID and client secret
|
||||||
|
Reference in New Issue
Block a user