mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Merge branch 'V5-WIP' into V5-AuthCode
# Conflicts: # src/Grant/AbstractGrant.php
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace League\OAuth2\Server\Grant;
|
||||
|
||||
use League\Event\EmitterAwareTrait;
|
||||
use League\Event\EmitterInterface;
|
||||
use League\Event\Event;
|
||||
use League\OAuth2\Server\Entities\AccessTokenEntity;
|
||||
@@ -29,6 +30,8 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||
*/
|
||||
abstract class AbstractGrant implements GrantTypeInterface
|
||||
{
|
||||
use EmitterAwareTrait;
|
||||
|
||||
const SCOPE_DELIMITER_STRING = ' ';
|
||||
|
||||
/**
|
||||
@@ -53,11 +56,6 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
*/
|
||||
protected $accessTokenRepository;
|
||||
|
||||
/**
|
||||
* @var \League\Event\Emitter
|
||||
*/
|
||||
protected $emitter;
|
||||
|
||||
/**
|
||||
* @var ScopeRepositoryInterface
|
||||
*/
|
||||
@@ -121,7 +119,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function setEmitter(EmitterInterface $emitter)
|
||||
public function setEmitter(EmitterInterface $emitter = null)
|
||||
{
|
||||
$this->emitter = $emitter;
|
||||
}
|
||||
@@ -181,14 +179,14 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
}
|
||||
|
||||
$client = $this->clientRepository->getClientEntity(
|
||||
$this->getIdentifier(),
|
||||
$clientId,
|
||||
$clientSecret,
|
||||
$redirectUri,
|
||||
$this->getIdentifier()
|
||||
$redirectUri
|
||||
);
|
||||
|
||||
if (!$client instanceof ClientEntityInterface) {
|
||||
$this->emitter->emit(new Event('client.authentication.failed', $request));
|
||||
$this->getEmitter()->emit(new Event('client.authentication.failed', $request));
|
||||
|
||||
throw OAuthServerException::invalidClient();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user