deleteState() public static method

This function deletes the given state to prevent the user from reusing it later.
public static deleteState ( &$state )
Ejemplo n.º 1
0
 /**
  * Complete logout.
  *
  * This function should be called after logout has completed. It will never return,
  * except in the case of exceptions. Exceptions thrown from this page should not be caught,
  * but should instead be passed to the top-level exception handler.
  *
  * @param array &$state  Information about the current authentication.
  */
 public static function completeLogout(&$state)
 {
     assert('is_array($state)');
     assert('array_key_exists("LogoutCompletedHandler", $state)');
     SimpleSAML_Auth_State::deleteState($state);
     $func = $state['LogoutCompletedHandler'];
     assert('is_callable($func)');
     call_user_func($func, $state);
     assert(FALSE);
 }
Ejemplo n.º 2
0
 /**
  * Log out from this authentication source.
  *
  * This function should be overridden if the authentication source requires special
  * steps to complete a logout operation.
  *
  * If the logout process requires a redirect, the state should be saved. Once the
  * logout operation is completed, the state should be restored, and completeLogout
  * should be called with the state. If this operation can be completed without
  * showing the user a page, or redirecting, this function should return.
  *
  * @param array &$state  Information about the current logout operation.
  */
 public function logout(&$state)
 {
     assert('is_array($state)');
     $logoutUrl = $this->_casConfig['logout'];
     SimpleSAML_Auth_State::deleteState($state);
     // we want cas to log us out
     SimpleSAML_Utilities::redirect($logoutUrl, array());
 }
Ejemplo n.º 3
0
 /**
  * Continues processing of the state.
  *
  * This function is used to resume processing by filters which for example needed to show
  * a page to the user.
  *
  * This function will never return. Exceptions thrown during processing will be passed
  * to whatever exception handler is defined in the state array.
  *
  * @param array $state  The state we are processing.
  */
 public static function resumeProcessing($state)
 {
     assert('is_array($state)');
     while (count($state[self::FILTERS_INDEX]) > 0) {
         $filter = array_shift($state[self::FILTERS_INDEX]);
         try {
             $filter->process($state);
         } catch (SimpleSAML_Error_Exception $e) {
             SimpleSAML_Auth_State::throwException($state, $e);
         } catch (Exception $e) {
             $e = new SimpleSAML_Error_UnserializableException($e);
             SimpleSAML_Auth_State::throwException($state, $e);
         }
     }
     /* Completed. */
     assert('array_key_exists("ReturnURL", $state) || array_key_exists("ReturnCall", $state)');
     assert('!array_key_exists("ReturnURL", $state) || !array_key_exists("ReturnCall", $state)');
     if (array_key_exists('ReturnURL', $state)) {
         /*
          * Save state information, and redirect to the URL specified
          * in $state['ReturnURL'].
          */
         $id = SimpleSAML_Auth_State::saveState($state, self::COMPLETED_STAGE);
         SimpleSAML_Utilities::redirectTrustedURL($state['ReturnURL'], array(self::AUTHPARAM => $id));
     } else {
         /* Pass the state to the function defined in $state['ReturnCall']. */
         /* We are done with the state array in the session. Delete it. */
         SimpleSAML_Auth_State::deleteState($state);
         $func = $state['ReturnCall'];
         assert('is_callable($func)');
         call_user_func($func, $state);
         assert(FALSE);
     }
 }
Ejemplo n.º 4
0
 /**
  * Log out from this authentication source.
  *
  * This function should be overridden if the authentication source requires special
  * steps to complete a logout operation.
  *
  * If the logout process requires a redirect, the state should be saved. Once the
  * logout operation is completed, the state should be restored, and completeLogout
  * should be called with the state. If this operation can be completed without
  * showing the user a page, or redirecting, this function should return.
  *
  * @param array &$state  Information about the current logout operation.
  */
 public function logout(&$state)
 {
     assert('is_array($state)');
     $logoutUrl = $this->_casConfig['logout'];
     SimpleSAML_Auth_State::deleteState($state);
     // we want cas to log us out
     \SimpleSAML\Utils\HTTP::redirectTrustedURL($logoutUrl);
 }