mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Added league/event and implemented SessionOwnerEvent
This commit is contained in:
@@ -14,6 +14,7 @@ namespace League\OAuth2\Server;
|
||||
use League\OAuth2\Server\Exception;
|
||||
use League\OAuth2\Server\TokenType\TokenTypeInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use League\Event\Emitter;
|
||||
|
||||
/**
|
||||
* OAuth 2.0 Resource Server
|
||||
@@ -40,6 +41,37 @@ abstract class AbstractServer
|
||||
*/
|
||||
protected $tokenType;
|
||||
|
||||
/**
|
||||
* Event emitter
|
||||
*/
|
||||
protected $eventEmitter;
|
||||
|
||||
/**
|
||||
* Abstract server constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->eventEmitter = $this->setEventEmitter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an event emitter
|
||||
* @param object $emitter Event emitter object
|
||||
*/
|
||||
public function setEventEmitter($emitter = null)
|
||||
{
|
||||
if ($emitter === null) {
|
||||
$this->eventEmitter = new Emitter;
|
||||
} else {
|
||||
$this->eventEmitter = $emitter;
|
||||
}
|
||||
}
|
||||
|
||||
public function addEventListener($eventName, callable $listener)
|
||||
{
|
||||
$this->eventEmitter->addListener($eventName, $listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Request Object
|
||||
* @param \Symfony\Component\HttpFoundation\Request The Request Object
|
||||
|
||||
Reference in New Issue
Block a user