Added grant to getClient calls. Fixes #21

This commit is contained in:
Alex Bilbie 2013-03-27 14:47:07 +00:00
parent 18933d5075
commit a7b4f7d66b
5 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
} }