예제 #1
0
 /**
  * Use a transient session.
  *
  * Create a session that should not be saved at the end of the request.
  * Subsequent calls to getInstance() will return this transient session.
  */
 public static function useTransientSession()
 {
     if (isset(self::$instance)) {
         /* We already have a session. Don't bother with a transient session. */
         return;
     }
     self::$instance = new SimpleSAML_Session(TRUE);
 }
예제 #2
0
 /**
  * Load a given session as the current one.
  *
  * This method will also set the track ID in the logger to the one in the given session.
  *
  * Warning: never set self::$instance yourself, call this method instead.
  *
  * @param SimpleSAML_Session $session The session to load.
  * @return SimpleSAML_Session The session we just loaded, just for convenience.
  */
 private static function load(SimpleSAML_Session $session)
 {
     SimpleSAML\Logger::setTrackId($session->getTrackID());
     self::$instance = $session;
     return self::$instance;
 }
예제 #3
0
 /**
  * Retrieves the current session. Will create a new session if there isn't a session.
  *
  * @return The current session.
  */
 public static function getInstance()
 {
     /* Check if we already have initialized the session. */
     if (isset(self::$instance)) {
         return self::$instance;
     }
     /* Check if we have stored a session stored with the session
      * handler.
      */
     self::$instance = self::loadSession();
     if (self::$instance !== NULL) {
         //print "FOUND AND IS USING A SESSION INSTANCE<br>"; // TODO remove
         return self::$instance;
     }
     //print "DID NOT FIND A SESSION INSTANCE<br>"; // TODO Remove
     /* Create a new session. */
     self::$instance = new SimpleSAML_Session();
     /* Save the new session with the session handler. */
     $sh = SimpleSAML_SessionHandler::getSessionHandler();
     $sh->set('SimpleSAMLphp_SESSION', self::$instance);
     return self::$instance;
 }
예제 #4
0
 /**
  * Use a transient session.
  *
  * Create a session that should not be saved at the end of the request.
  * Subsequent calls to getInstance() will return this transient session.
  */
 public static function useTransientSession()
 {
     if (isset(self::$instance)) {
         // we already have a session, don't bother with a transient session
         return;
     }
     self::$instance = new SimpleSAML_Session(true);
 }
예제 #5
0
파일: Session.php 프로젝트: hukumonline/yii
 /**
  * Retrieves the current session. Will create a new session if there isn't a session.
  *
  * @return The current session.
  */
 public static function getInstance()
 {
     /* Check if we already have initialized the session. */
     if (isset(self::$instance)) {
         return self::$instance;
     }
     /* Check if we have stored a session stored with the session
      * handler.
      */
     self::$instance = self::loadSession();
     if (self::$instance !== NULL) {
         return self::$instance;
     }
     /* Create a new session. */
     self::$instance = new SimpleSAML_Session();
     /* Save the new session with the session handler. */
     $sh = SimpleSAML_SessionHandler::getSessionHandler();
     $sh->set('SimpleSAMLphp_SESSION', self::$instance);
     return self::$instance;
 }