getRelayState() публичный Метод

Retrieve the RelayState associated with this message.
public getRelayState ( ) : string | null
Результат string | null The RelayState, or NULL if no RelayState is given
Пример #1
0
 /**
  * Create the redirect URL for a message.
  *
  * @param  \SAML2\Message $message The message.
  * @return string        The URL the user should be redirected to in order to send a message.
  * @throws \Exception
  */
 public function getRedirectURL(Message $message)
 {
     $store = SimpleSAML_Store::getInstance();
     if ($store === false) {
         throw new \Exception('Unable to send artifact without a datastore configured.');
     }
     $generatedId = pack('H*', (string) SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(20)));
     $artifact = base64_encode("" . sha1($message->getIssuer(), true) . $generatedId);
     $artifactData = $message->toUnsignedXML();
     $artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
     $store->set('artifact', $artifact, $artifactDataString, Temporal::getTime() + 15 * 60);
     $params = array('SAMLart' => $artifact);
     $relayState = $message->getRelayState();
     if ($relayState !== null) {
         $params['RelayState'] = $relayState;
     }
     return SimpleSAML_Utilities::addURLparameter($message->getDestination(), $params);
 }
Пример #2
0
 /**
  * Create the redirect URL for a message.
  *
  * @param  \SAML2\Message $message The message.
  * @return string        The URL the user should be redirected to in order to send a message.
  */
 public function getRedirectURL(Message $message)
 {
     if ($this->destination === null) {
         $destination = $message->getDestination();
     } else {
         $destination = $this->destination;
     }
     $relayState = $message->getRelayState();
     $key = $message->getSignatureKey();
     $msgStr = $message->toUnsignedXML();
     $msgStr = $msgStr->ownerDocument->saveXML($msgStr);
     Utils::getContainer()->debugMessage($msgStr, 'out');
     $msgStr = gzdeflate($msgStr);
     $msgStr = base64_encode($msgStr);
     /* Build the query string. */
     if ($message instanceof Request) {
         $msg = 'SAMLRequest=';
     } else {
         $msg = 'SAMLResponse=';
     }
     $msg .= urlencode($msgStr);
     if ($relayState !== null) {
         $msg .= '&RelayState=' . urlencode($relayState);
     }
     if ($key !== null) {
         /* Add the signature. */
         $msg .= '&SigAlg=' . urlencode($key->type);
         $signature = $key->signData($msg);
         $msg .= '&Signature=' . urlencode(base64_encode($signature));
     }
     if (strpos($destination, '?') === false) {
         $destination .= '?' . $msg;
     } else {
         $destination .= '&' . $msg;
     }
     return $destination;
 }