Refactored out claim check logic to its own class
This commit is contained in:
@ -21,13 +21,8 @@ class WsSubscriber implements SubscriberInterface, EventEmitterInterface
|
||||
const EVENT_UNSUBSCRIBE = 'unsubscribe';
|
||||
const EVENT_ERROR = 'error';
|
||||
|
||||
const STATE_UNAUTHORIZED = 0;
|
||||
const STATE_AUTHORIZED = 1;
|
||||
|
||||
private string $id;
|
||||
|
||||
private int $state = self::STATE_UNAUTHORIZED;
|
||||
|
||||
public function __construct(
|
||||
private WebSocketConnection $stream,
|
||||
private ServerRequestInterface $request,
|
||||
@ -73,6 +68,11 @@ class WsSubscriber implements SubscriberInterface, EventEmitterInterface
|
||||
return $this->token && $this->token->isValid();
|
||||
}
|
||||
|
||||
public function getMercureClaims(): ?array
|
||||
{
|
||||
return $this->request->getAttribute('mercure.claims');
|
||||
}
|
||||
|
||||
public function getPayload(): array
|
||||
{
|
||||
return $this->request->getAttribute('mercure.payload')??[];
|
||||
|
Reference in New Issue
Block a user