createSession() public static method

Create a new session and cache it.
public static createSession ( string $sessionId )
$sessionId string The new session we should create.
 /**
  * Create and set new session id.
  *
  * @return string  The new session id.
  */
 public function newSessionId()
 {
     $this->session_id = self::createSessionID();
     SimpleSAML_Session::createSession($this->session_id);
     $this->setCookie($this->cookie_name, $this->session_id);
     return $this->session_id;
 }
 /**
  * Retrieve the session id of saved in the session cookie.
  *
  * @return string  The session id saved in the cookie.
  */
 public function getCookieSessionId()
 {
     if ($this->session_id === NULL) {
         if (self::hasSessionCookie()) {
             /* Attempt to retrieve the session id from the cookie. */
             $this->session_id = $_COOKIE[$this->cookie_name];
         }
         /* Check if we have a valid session id. */
         if (!self::isValidSessionID($this->session_id)) {
             /* We don't have a valid session. Create a new session id. */
             $this->session_id = self::createSessionID();
             SimpleSAML_Session::createSession($this->session_id);
             $this->setCookie($this->cookie_name, $this->session_id);
         }
     }
     return $this->session_id;
 }
 /**
  * Create and set new session id.
  *
  * @return string  The new session id.
  */
 public function newSessionId()
 {
     $session_cookie_params = session_get_cookie_params();
     if ($session_cookie_params['secure'] && !SimpleSAML_Utilities::isHTTPS()) {
         throw new SimpleSAML_Error_Exception('Session start with secure cookie not allowed on http.');
     }
     if (headers_sent()) {
         throw new SimpleSAML_Error_Exception('Cannot create new session - headers already sent.');
     }
     /* Generate new (secure) session id. */
     $sessionId = SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(16));
     SimpleSAML_Session::createSession($sessionId);
     if (session_id() !== '') {
         /* Session already started, close it. */
         session_write_close();
     }
     session_id($sessionId);
     session_start();
     return session_id();
 }
 /**
  * Create and set new session id.
  *
  * @return string The new session id.
  *
  * @throws SimpleSAML_Error_Exception If the cookie is marked as secure but we are not using HTTPS, or the headers
  * were already sent and therefore we cannot set the cookie.
  */
 public function newSessionId()
 {
     $session_cookie_params = session_get_cookie_params();
     if ($session_cookie_params['secure'] && !\SimpleSAML\Utils\HTTP::isHTTPS()) {
         throw new SimpleSAML_Error_Exception('Session start with secure cookie not allowed on http.');
     }
     if (headers_sent()) {
         throw new SimpleSAML_Error_Exception('Cannot create new session - headers already sent.');
     }
     // generate new (secure) session id
     $sessionId = bin2hex(openssl_random_pseudo_bytes(16));
     SimpleSAML_Session::createSession($sessionId);
     if (session_id() !== '') {
         // session already started, close it
         session_write_close();
     }
     session_id($sessionId);
     session_start();
     return session_id();
 }
 /**
  * Retrieve the session id of saved in the session cookie.
  *
  * @return string  The session id saved in the cookie.
  */
 public function getCookieSessionId()
 {
     if (session_id() === '') {
         $session_cookie_params = session_get_cookie_params();
         if ($session_cookie_params['secure'] && !SimpleSAML_Utilities::isHTTPS()) {
             throw new SimpleSAML_Error_Exception('Session start with secure cookie not allowed on http.');
         }
         if (!self::hasSessionCookie()) {
             if (headers_sent()) {
                 throw new SimpleSAML_Error_Exception('Cannot create new session - headers already sent.');
             }
             /* Session cookie unset - session id not set. Generate new (secure) session id. */
             $sessionId = SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(16));
             SimpleSAML_Session::createSession($sessionId);
             session_id($sessionId);
         }
         session_start();
     }
     return session_id();
 }
 /**
  * Create a new session id.
  *
  * @return string The new session id.
  */
 public function newSessionId()
 {
     // generate new (secure) session id
     $sessionId = bin2hex(openssl_random_pseudo_bytes(16));
     SimpleSAML_Session::createSession($sessionId);
     return $sessionId;
 }