| 1 | <?php |
||
| 17 | class TokenSubscriber implements SubscriberInterface, LoggerAwareInterface |
||
| 18 | { |
||
| 19 | use LoggerAwareTrait; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @const string |
||
| 23 | */ |
||
| 24 | const AUTH_BEARER = 'Bearer %s'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var TokenManager |
||
| 28 | */ |
||
| 29 | private $tokenManager; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * TokenSubscriber constructor. |
||
| 33 | * |
||
| 34 | * @param TokenManager $tokenManager |
||
| 35 | */ |
||
| 36 | 6 | public function __construct(TokenManager $tokenManager) |
|
| 37 | { |
||
| 38 | 6 | $this->tokenManager = $tokenManager; |
|
| 39 | 6 | } |
|
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | public function getEvents() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Add the Authorization header to requests. |
||
| 53 | * |
||
| 54 | * @param BeforeEvent $event Event received |
||
| 55 | */ |
||
| 56 | public function onBefore(BeforeEvent $event) |
||
| 68 | } |
||
| 69 |