コード例 #1
0
ファイル: AssertionAction.php プロジェクト: aarnaud/lightSAML
 /**
  * @param ProfileContext $context
  */
 protected function doExecute(ProfileContext $context)
 {
     $response = MessageContextHelper::asResponse($context->getInboundContext());
     foreach ($response->getAllAssertions() as $index => $assertion) {
         $name = sprintf('assertion_%s', $index);
         /** @var AssertionContext $assertionContext */
         $assertionContext = $context->getSubContext($name, AssertionContext::class);
         $assertionContext->setAssertion($assertion)->setId($name);
         $this->assertionAction->execute($assertionContext);
     }
 }
コード例 #2
0
 /**
  * @param ProfileContext $context
  *
  * @return void
  */
 protected function doExecute(ProfileContext $context)
 {
     $response = MessageContextHelper::asResponse($context->getOutboundContext());
     foreach ($this->assertionActions as $index => $action) {
         $name = sprintf('assertion_%s', $index);
         /** @var AssertionContext $assertionContext */
         $assertionContext = $context->getSubContext($name, AssertionContext::class);
         $assertionContext->setId($index);
         $action->execute($assertionContext);
         if ($assertionContext->getEncryptedAssertion()) {
             $response->addEncryptedAssertion($assertionContext->getEncryptedAssertion());
         } elseif ($assertionContext->getAssertion()) {
             $response->addAssertion($assertionContext->getAssertion());
         } else {
             $this->logger->warning('No assertion was built', LogHelper::getActionContext($context, $this));
         }
     }
 }
コード例 #3
0
 /**
  * @param ProfileContext $context
  */
 protected function doExecute(ProfileContext $context)
 {
     $ownEntityDescriptor = $context->getOwnEntityDescriptor();
     /** @var SerializationContext $serializationContext */
     $serializationContext = $context->getSubContext(ProfileContexts::SERIALIZATION, SerializationContext::class);
     $serializationContext->getDocument()->formatOutput = true;
     $ownEntityDescriptor->serialize($serializationContext->getDocument(), $serializationContext);
     $xml = $serializationContext->getDocument()->saveXML();
     $response = new Response($xml);
     $contentType = 'text/xml';
     $acceptableContentTypes = array_flip($context->getHttpRequest()->getAcceptableContentTypes());
     foreach ($this->supportedContextTypes as $supportedContentType) {
         if (isset($acceptableContentTypes[$supportedContentType])) {
             $contentType = $supportedContentType;
             break;
         }
     }
     $response->headers->replace(array('Content-Type' => $contentType));
     $context->getHttpResponseContext()->setResponse($response);
 }