当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::submitPOSTData方法代码示例

本文整理汇总了PHP中SimpleSAML\Utils\HTTP::submitPOSTData方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::submitPOSTData方法的具体用法?PHP HTTP::submitPOSTData怎么用?PHP HTTP::submitPOSTData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSAML\Utils\HTTP的用法示例。


在下文中一共展示了HTTP::submitPOSTData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendResponse

 /**
  * Send an authenticationResponse using HTTP-POST.
  *
  * @param string                   $response The response which should be sent.
  * @param SimpleSAML_Configuration $idpmd The metadata of the IdP which is sending the response.
  * @param SimpleSAML_Configuration $spmd The metadata of the SP which is receiving the response.
  * @param string|null              $relayState The relaystate for the SP.
  * @param string                   $shire The shire which should receive the response.
  */
 public function sendResponse($response, SimpleSAML_Configuration $idpmd, SimpleSAML_Configuration $spmd, $relayState, $shire)
 {
     \SimpleSAML\Utils\XML::checkSAMLMessage($response, 'saml11');
     $privatekey = SimpleSAML\Utils\Crypto::loadPrivateKey($idpmd, true);
     $publickey = SimpleSAML\Utils\Crypto::loadPublicKey($idpmd, true);
     $responsedom = new DOMDocument();
     $responsedom->loadXML(str_replace("\r", "", $response));
     $responseroot = $responsedom->getElementsByTagName('Response')->item(0);
     $firstassertionroot = $responsedom->getElementsByTagName('Assertion')->item(0);
     /* Determine what we should sign - either the Response element or the Assertion. The default is to sign the
      * Assertion, but that can be overridden by the 'signresponse' option in the SP metadata or
      * 'saml20.signresponse' in the global configuration.
      *
      * TODO: neither 'signresponse' nor 'shib13.signresponse' are valid options any longer. Remove!
      */
     if ($spmd->hasValue('signresponse')) {
         $signResponse = $spmd->getBoolean('signresponse');
     } else {
         $signResponse = $this->configuration->getBoolean('shib13.signresponse', true);
     }
     // check if we have an assertion to sign. Force to sign the response if not
     if ($firstassertionroot === null) {
         $signResponse = true;
     }
     $signer = new SimpleSAML_XML_Signer(array('privatekey_array' => $privatekey, 'publickey_array' => $publickey, 'id' => $signResponse ? 'ResponseID' : 'AssertionID'));
     if ($idpmd->hasValue('certificatechain')) {
         $signer->addCertificate($idpmd->getString('certificatechain'));
     }
     if ($signResponse) {
         // sign the response - this must be done after encrypting the assertion
         // we insert the signature before the saml2p:Status element
         $statusElements = SimpleSAML\Utils\XML::getDOMChildren($responseroot, 'Status', '@saml1p');
         assert('count($statusElements) === 1');
         $signer->sign($responseroot, $responseroot, $statusElements[0]);
     } else {
         /* Sign the assertion */
         $signer->sign($firstassertionroot, $firstassertionroot);
     }
     $response = $responsedom->saveXML();
     \SimpleSAML\Utils\XML::debugSAMLMessage($response, 'out');
     \SimpleSAML\Utils\HTTP::submitPOSTData($shire, array('TARGET' => $relayState, 'SAMLResponse' => base64_encode($response)));
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:51,代码来源:HTTPPost.php

示例2: send

 /**
  * Helper function for sending CDC messages.
  *
  * @param string $to  The URL the message should be delivered to.
  * @param string $parameter  The query parameter the message should be sent in.
  * @param array $message  The CDC message.
  */
 private function send($to, $parameter, array $message)
 {
     assert('is_string($to)');
     assert('is_string($parameter)');
     $message['timestamp'] = time();
     $message = json_encode($message);
     $message = base64_encode($message);
     $signature = $this->calcSignature($message);
     $params = array($parameter => $message, 'Signature' => $signature);
     $url = \SimpleSAML\Utils\HTTP::addURLParameters($to, $params);
     if (strlen($url) < 2048) {
         \SimpleSAML\Utils\HTTP::redirectTrustedURL($url);
     } else {
         \SimpleSAML\Utils\HTTP::submitPOSTData($to, $params);
     }
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:23,代码来源:Server.php

示例3: postRedirect

 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::submitPOSTData() instead.
  */
 public static function postRedirect($destination, $post)
 {
     \SimpleSAML\Utils\HTTP::submitPOSTData($destination, $post);
 }
开发者ID:jstormes,项目名称:simplesamlphp,代码行数:7,代码来源:Utilities.php


注:本文中的SimpleSAML\Utils\HTTP::submitPOSTData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。