mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Change to use invalid_grant
This commit is contained in:
parent
fe421878e6
commit
2b4974b697
@ -81,11 +81,13 @@ class PasswordGrant extends AbstractGrant
|
|||||||
protected function validateUser(ServerRequestInterface $request, ClientEntityInterface $client)
|
protected function validateUser(ServerRequestInterface $request, ClientEntityInterface $client)
|
||||||
{
|
{
|
||||||
$username = $this->getRequestParameter('username', $request);
|
$username = $this->getRequestParameter('username', $request);
|
||||||
|
|
||||||
if (is_null($username)) {
|
if (is_null($username)) {
|
||||||
throw OAuthServerException::invalidRequest('username');
|
throw OAuthServerException::invalidRequest('username');
|
||||||
}
|
}
|
||||||
|
|
||||||
$password = $this->getRequestParameter('password', $request);
|
$password = $this->getRequestParameter('password', $request);
|
||||||
|
|
||||||
if (is_null($password)) {
|
if (is_null($password)) {
|
||||||
throw OAuthServerException::invalidRequest('password');
|
throw OAuthServerException::invalidRequest('password');
|
||||||
}
|
}
|
||||||
@ -96,10 +98,11 @@ class PasswordGrant extends AbstractGrant
|
|||||||
$this->getIdentifier(),
|
$this->getIdentifier(),
|
||||||
$client
|
$client
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($user instanceof UserEntityInterface === false) {
|
if ($user instanceof UserEntityInterface === false) {
|
||||||
$this->getEmitter()->emit(new RequestEvent(RequestEvent::USER_AUTHENTICATION_FAILED, $request));
|
$this->getEmitter()->emit(new RequestEvent(RequestEvent::USER_AUTHENTICATION_FAILED, $request));
|
||||||
|
|
||||||
throw OAuthServerException::invalidCredentials();
|
throw OAuthServerException::invalidGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
Loading…
Reference in New Issue
Block a user