protected function doExecute(ProfileContext $context)
 {
     if (null == $context->getInboundContext()->getMessage()) {
         return;
     }
     $this->logger->debug(sprintf('Forwarding relay state: "%s"', $context->getInboundMessage()->getRelayState()));
     $context->getOutboundMessage()->setRelayState($context->getInboundMessage()->getRelayState());
 }
 /**
  * @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_outbound_message_returns_from_context()
 {
     $profileContext = new ProfileContext(Profiles::METADATA, ProfileContext::ROLE_IDP);
     $profileContext->getOutboundContext()->setMessage($expectedValue = $this->getMockForAbstractClass(SamlMessage::class));
     $this->assertSame($expectedValue, $profileContext->getOutboundMessage());
 }