diff --git a/composer.json b/composer.json index cb54606c3..8a17e4f7f 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "league/oauth2-server", + "name": "attoiuma/oauth2-server", "description": "A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.", "homepage": "https://oauth2.thephpleague.com/", "license": "MIT", diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index cb53ccd8b..951507e7b 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -92,11 +92,17 @@ protected function validateUser(ServerRequestInterface $request, ClientEntityInt throw OAuthServerException::invalidRequest('password'); } - $user = $this->userRepository->getUserEntityByUserCredentials( + $provider = $this->getRequestParameter('provider', $request); + if (is_null($provider)) { + throw OAuthServerException::invalidRequest('provider'); + } + + $user = $this->userRepository->getEntityByUserCredentials( $username, $password, $this->getIdentifier(), - $client + $client, + $provider ); if ($user instanceof UserEntityInterface === false) { $this->getEmitter()->emit(new RequestEvent(RequestEvent::USER_AUTHENTICATION_FAILED, $request));