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


PHP SimpleSAML_Session::createSession方法代码示例

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


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

示例1: newSessionId

 /**
  * 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;
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:12,代码来源:SessionHandlerCookie.php

示例2: getCookieSessionId

 /**
  * 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;
 }
开发者ID:rchavik,项目名称:simplesamlphp,代码行数:22,代码来源:SessionHandlerCookie.php

示例3: newSessionId

 /**
  * 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();
 }
开发者ID:williamamed,项目名称:Raptor2,代码行数:25,代码来源:SessionHandlerPHP.php

示例4: newSessionId

 /**
  * 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();
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:28,代码来源:SessionHandlerPHP.php

示例5: getCookieSessionId

 /**
  * 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();
 }
开发者ID:rchavik,项目名称:simplesamlphp,代码行数:25,代码来源:SessionHandlerPHP.php

示例6: newSessionId

 /**
  * 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;
 }
开发者ID:simplesamlphp,项目名称:simplesamlphp,代码行数:12,代码来源:SessionHandlerPHP.php


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