mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-16 18:19:47 +05:30
Minor fixes to password grant
This commit is contained in:
parent
d2267dbd24
commit
61d1685e84
@ -31,13 +31,13 @@ class Password implements GrantTypeInterface {
|
|||||||
$this->callback = $callback;
|
$this->callback = $callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getVerifyCredentialsCallback($username, $password)
|
protected function getVerifyCredentialsCallback()
|
||||||
{
|
{
|
||||||
if (is_null($this->callback) || ! is_callable($this->callback)) {
|
if (is_null($this->callback) || ! is_callable($this->callback)) {
|
||||||
throw new Exception\InvalidGrantTypeException('Null or non-callable callback set');
|
throw new Exception\InvalidGrantTypeException('Null or non-callable callback set');
|
||||||
}
|
}
|
||||||
|
|
||||||
return call_user_func($this->callback, $username, $password);
|
return $this->callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function completeFlow($inputParams = null, $authParams = array())
|
public function completeFlow($inputParams = null, $authParams = array())
|
||||||
@ -88,7 +88,7 @@ class Password implements GrantTypeInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if user's username and password are correct
|
// Check if user's username and password are correct
|
||||||
$userId = call_user_func($this->getVerifyCredentialsCallback, $params['username'], $params['password']);
|
$userId = call_user_func($this->getVerifyCredentialsCallback(), $authParams['username'], $authParams['password']);
|
||||||
|
|
||||||
if ($userId === false) {
|
if ($userId === false) {
|
||||||
throw new Exception\ClientException(AuthServer::getExceptionMessage('invalid_credentials'), 0);
|
throw new Exception\ClientException(AuthServer::getExceptionMessage('invalid_credentials'), 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user