setData() public method

The timeout value can be SimpleSAML_Session::DATA_TIMEOUT_SESSION_END, which indicates that the data should never be deleted.
public setData ( string $type, string $id, mixed $data, integer | null $timeout = null )
$type string The type of the data. This is checked when retrieving data from the store.
$id string The identifier of the data.
$data mixed The data.
$timeout integer | null The number of seconds this data should be stored after its last access. This parameter is optional. The default value is set in 'session.datastore.timeout', and the default is 4 hours.
Example #1
0
 /**
  * Save the given HTTP POST data and the destination where it should be posted to a given session.
  *
  * @param \SimpleSAML_Session $session The session where to temporarily store the data.
  * @param string              $destination The destination URL where the form should be posted.
  * @param array               $data An associative array with the data to be posted to $destination.
  *
  * @return string A random identifier that can be used to retrieve the data from the current session.
  *
  * @author Andjelko Horvat
  * @author Jaime Perez, UNINETT AS <*****@*****.**>
  */
 private static function savePOSTData(\SimpleSAML_Session $session, $destination, $data)
 {
     // generate a random ID to avoid replay attacks
     $id = Random::generateID();
     $postData = array('post' => $data, 'url' => $destination);
     // save the post data to the session, tied to the random ID
     $session->setData('core_postdatalink', $id, $postData);
     return $id;
 }