Пример #1
0
 protected function doExecute(ProfileContext $context)
 {
     $shouldSign = $this->shouldSignMessage($context);
     if ($shouldSign) {
         $signature = $this->signatureResolver->getSignature($context);
         if ($signature) {
             MessageContextHelper::asSamlMessage($context->getOutboundContext())->setSignature($signature);
             $this->logger->debug(sprintf('Message signed with fingerprint "%s"', $signature->getCertificate()->getFingerprint()), LogHelper::getActionContext($context, $this, array('certificate' => $signature->getCertificate()->getInfo())));
         } else {
             $this->logger->critical('No signature resolved, although signing enabled', LogHelper::getActionErrorContext($context, $this, array()));
         }
     } else {
         $this->logger->debug('Signing disabled', LogHelper::getActionContext($context, $this));
     }
 }
 /**
  * @param AssertionContext $context
  *
  * @return void
  */
 protected function doExecute(AssertionContext $context)
 {
     $profileContext = $context->getProfileContext();
     $trustOptions = $profileContext->getTrustOptions();
     if ($trustOptions->getSignAssertions()) {
         $signature = $this->signatureResolver->getSignature($profileContext);
         if ($signature) {
             $this->logger->debug(sprintf('Signing assertion with fingerprint %s', $signature->getCertificate()->getFingerprint()), LogHelper::getActionContext($context, $this, array('certificate' => $signature->getCertificate()->getInfo())));
             $context->getAssertion()->setSignature($signature);
         } else {
             $this->logger->critical('Unable to resolve assertion signature, though signing enabled', LogHelper::getActionErrorContext($context, $this));
         }
     } else {
         $this->logger->debug('Assertion signing disabled', LogHelper::getActionContext($context, $this));
     }
 }