/** * @param ProfileContext $context * * @return bool */ private function shouldSignMessage(ProfileContext $context) { $message = $context->getOutboundMessage(); if ($message instanceof LogoutRequest) { return true; } $trustOptions = $context->getTrustOptions(); if ($message instanceof AuthnRequest) { return $trustOptions->getSignAuthnRequest(); } elseif ($message instanceof Response) { return $trustOptions->getSignResponse(); } throw new \LogicException(sprintf('Unexpected message type "%s"', get_class($message))); }
public function test__get_trust_options_returns_from_context() { $profileContext = new ProfileContext(Profiles::METADATA, ProfileContext::ROLE_IDP); $profileContext->getPartyEntityContext()->setTrustOptions($expectedValue = new TrustOptions()); $this->assertSame($expectedValue, $profileContext->getTrustOptions()); }