mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 13:39:48 +05:30
Added grant to getClient calls. Fixes #21
This commit is contained in:
parent
18933d5075
commit
a7b4f7d66b
@ -93,7 +93,7 @@ class AuthCode implements GrantTypeInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and redirect URI
|
// Validate client ID and redirect URI
|
||||||
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret'], $authParams['redirect_uri']);
|
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret'], $authParams['redirect_uri'], $this->identifier);
|
||||||
|
|
||||||
if ($clientDetails === false) {
|
if ($clientDetails === false) {
|
||||||
throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
|
throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
|
||||||
|
@ -89,7 +89,7 @@ class ClientCredentials implements GrantTypeInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and client secret
|
// Validate client ID and client secret
|
||||||
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret']);
|
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret'], null, $this->identifier);
|
||||||
|
|
||||||
if ($clientDetails === false) {
|
if ($clientDetails === false) {
|
||||||
throw new Exception\ClientException(AuthServer::getExceptionMessage('invalid_client'), 8);
|
throw new Exception\ClientException(AuthServer::getExceptionMessage('invalid_client'), 8);
|
||||||
|
@ -116,8 +116,8 @@ class Password implements GrantTypeInterface {
|
|||||||
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'client_secret'), 0);
|
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'client_secret'), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and redirect URI
|
// Validate client credentials
|
||||||
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret']);
|
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret'], null, $this->identifier);
|
||||||
|
|
||||||
if ($clientDetails === false) {
|
if ($clientDetails === false) {
|
||||||
throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
|
throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
|
||||||
|
@ -89,7 +89,7 @@ class RefreshToken implements GrantTypeInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and client secret
|
// Validate client ID and client secret
|
||||||
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret']);
|
$clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], $authParams['client_secret'], null, $this->identifier);
|
||||||
|
|
||||||
if ($clientDetails === false) {
|
if ($clientDetails === false) {
|
||||||
throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
|
throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
|
||||||
|
@ -48,7 +48,8 @@ interface ClientInterface
|
|||||||
* @param string $clientId The client's ID
|
* @param string $clientId The client's ID
|
||||||
* @param string $clientSecret The client's secret (default = "null")
|
* @param string $clientSecret The client's secret (default = "null")
|
||||||
* @param string $redirectUri The client's redirect URI (default = "null")
|
* @param string $redirectUri The client's redirect URI (default = "null")
|
||||||
|
* @param string $grantType The grant type used in the request
|
||||||
* @return bool|array Returns false if the validation fails, array on success
|
* @return bool|array Returns false if the validation fails, array on success
|
||||||
*/
|
*/
|
||||||
public function getClient($clientId = null, $clientSecret = null, $redirectUri = null);
|
public function getClient($clientId = null, $clientSecret = null, $redirectUri = null, $grantType = null);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user