/** * @param JwtContext $context * @return void */ protected function setResponseBindingType(JwtContext $context) { if ($context->getBearer()) { if (strlen($context->getResponseToken()) > 1200) { $context->setResponseBindingType(JwtBindingTypes::HTTP_POST); } else { $context->setResponseBindingType(JwtBindingTypes::HTTP_REDIRECT); } } else { $context->setResponseBindingType(JwtBindingTypes::CONTENT); } }
/** * @test * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid binding type */ public function shouldThrowOnSetResponseBindingTypeWithInvalidBindingType() { $context = new JwtContext(new Request(), JwtBindingTypes::HTTP_REDIRECT, null); $context->setResponseBindingType('foo'); }