Merge branch 'V5-WIP' into V5-AuthCode

# Conflicts:
#	src/Grant/AbstractGrant.php
This commit is contained in:
Alex Bilbie
2016-02-12 09:06:28 +00:00
17 changed files with 40 additions and 48 deletions

View File

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