getPOSTRedirectURL() public static method

Create a link which will POST data.
Author: Andjelko Horvat
Author: Jaime Perez, UNINETT AS (jaime.perez@uninett.no)
public static getPOSTRedirectURL ( string $destination, array $data ) : string
$destination string The destination URL.
$data array The name-value pairs which will be posted to the destination.
return string A URL which can be accessed to post the data.
Example #1
0
 /**
  * @deprecated This method will be removed in SSP 2.0. PLease use SimpleSAML\Utils\HTTP::getPOSTRedirectURL() instead.
  */
 public static function createPostRedirectLink($destination, $post)
 {
     return \SimpleSAML\Utils\HTTP::getPOSTRedirectURL($destination, $post);
 }
Example #2
0
 /**
  * Start an authentication process.
  *
  * This function never returns.
  *
  * This function accepts an array $params, which controls some parts of
  * the authentication. The accepted parameters depends on the authentication
  * source being used. Some parameters are generic:
  *  - 'ErrorURL': A URL that should receive errors from the authentication.
  *  - 'KeepPost': If the current request is a POST request, keep the POST
  *    data until after the authentication.
  *  - 'ReturnTo': The URL the user should be returned to after authentication.
  *  - 'ReturnCallback': The function we should call after the user has
  *    finished authentication.
  *
  * @param array $params  Various options to the authentication request.
  */
 public function login(array $params = array())
 {
     if (array_key_exists('KeepPost', $params)) {
         $keepPost = (bool) $params['KeepPost'];
     } else {
         $keepPost = TRUE;
     }
     if (array_key_exists('ReturnTo', $params)) {
         $returnTo = (string) $params['ReturnTo'];
     } else {
         if (array_key_exists('ReturnCallback', $params)) {
             $returnTo = (array) $params['ReturnCallback'];
         } else {
             $returnTo = \SimpleSAML\Utils\HTTP::getSelfURL();
         }
     }
     if (is_string($returnTo) && $keepPost && $_SERVER['REQUEST_METHOD'] === 'POST') {
         $returnTo = \SimpleSAML\Utils\HTTP::getPOSTRedirectURL($returnTo, $_POST);
     }
     if (array_key_exists('ErrorURL', $params)) {
         $errorURL = (string) $params['ErrorURL'];
     } else {
         $errorURL = NULL;
     }
     if (!isset($params[SimpleSAML_Auth_State::RESTART]) && is_string($returnTo)) {
         /*
          * A URL to restart the authentication, in case the user bookmarks
          * something, e.g. the discovery service page.
          */
         $restartURL = $this->getLoginURL($returnTo);
         $params[SimpleSAML_Auth_State::RESTART] = $restartURL;
     }
     $as = $this->getAuthSource();
     $as->initLogin($returnTo, $errorURL, $params);
     assert('FALSE');
 }