/**
  * @param array          $data
  * @param MessageContext $context
  *
  * @throws \Exception
  */
 protected function processData(array $data, MessageContext $context)
 {
     $msg = $this->getMessageStringFromData($data);
     $encoding = $this->getEncodingFromData($data);
     $msg = $this->decodeMessageString($msg, $encoding);
     $this->dispatchReceive($msg);
     $deserializationContext = $context->getDeserializationContext();
     $message = SamlMessage::fromXML($msg, $deserializationContext);
     $this->loadRelayState($message, $data);
     $this->loadSignature($message, $data);
     $context->setMessage($message);
 }
Beispiel #2
0
 /**
  * @param Request        $request
  * @param MessageContext $context
  */
 public function receive(Request $request, MessageContext $context)
 {
     $post = $request->request->all();
     if (array_key_exists('SAMLRequest', $post)) {
         $msg = $post['SAMLRequest'];
     } elseif (array_key_exists('SAMLResponse', $post)) {
         $msg = $post['SAMLResponse'];
     } else {
         throw new LightSamlBindingException('Missing SAMLRequest or SAMLResponse parameter');
     }
     $msg = base64_decode($msg);
     $this->dispatchReceive($msg);
     $deserializationContext = $context->getDeserializationContext();
     $result = SamlMessage::fromXML($msg, $deserializationContext);
     if (array_key_exists('RelayState', $post)) {
         $result->setRelayState($post['RelayState']);
     }
     $context->setMessage($result);
 }