/** * @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 */ public function shouldGetBearer() { $context = new JwtContext(new Request(), JwtBindingTypes::HTTP_REDIRECT, null); $context->setBearer($expectedBearer = 'bearer'); $this->assertEquals($expectedBearer, $context->getBearer()); }
/** * @param JwtContext $context * @return mixed|null */ public function getSubject(JwtContext $context) { return $context->getBearer(); }