/**
  * @test
  */
 public function shouldGetRequestJwt()
 {
     $context = new JwtContext(new Request(), JwtBindingTypes::HTTP_REDIRECT, null);
     $context->setRequestJwt($expectedJwt = new MethodJwt());
     $this->assertEquals($expectedJwt, $context->getRequestJwt());
 }
 /**
  * @param JwtContext $context
  * @throws \BWC\Component\JwtApiBundle\Error\JwtException
  */
 public function handleContext(JwtContext $context)
 {
     $token = $context->getRequestJwtToken();
     if ($this->logger) {
         $this->logger->debug('DecoderHandler.token', array('token' => $token));
     }
     /** @var MethodJwt $jwt */
     $jwt = $this->encoder->decode($token, $this->class);
     if ($this->logger) {
         $this->logger->debug('DecoderHandler.jwt', array('jwt' => $jwt));
     }
     if (false == $jwt instanceof MethodJwt) {
         throw new JwtException(sprintf("Expected MethodJwt but got '%s'", get_class($jwt)));
     }
     $context->setRequestJwt($jwt);
 }