當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTTP::redirectUntrustedURL方法代碼示例

本文整理匯總了PHP中SimpleSAML\Utils\HTTP::redirectUntrustedURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTTP::redirectUntrustedURL方法的具體用法?PHP HTTP::redirectUntrustedURL怎麽用?PHP HTTP::redirectUntrustedURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SimpleSAML\Utils\HTTP的用法示例。


在下文中一共展示了HTTP::redirectUntrustedURL方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handleUnsolicitedAuth

 /**
  * Handle an unsolicited login operations.
  *
  * This method creates a session from the information received. It will then redirect to the given URL. This is used
  * to handle IdP initiated SSO. This method will never return.
  *
  * @param string $authId The id of the authentication source that received the request.
  * @param array $state A state array.
  * @param string $redirectTo The URL we should redirect the user to after updating the session. The function will
  * check if the URL is allowed, so there is no need to manually check the URL on beforehand. Please refer to the
  * 'trusted.url.domains' configuration directive for more information about allowing (or disallowing) URLs.
  */
 public static function handleUnsolicitedAuth($authId, array $state, $redirectTo)
 {
     assert('is_string($authId)');
     assert('is_string($redirectTo)');
     $session = SimpleSAML_Session::getSessionFromRequest();
     $session->doLogin($authId, SimpleSAML_Auth_State::getPersistentAuthData($state));
     \SimpleSAML\Utils\HTTP::redirectUntrustedURL($redirectTo);
 }
開發者ID:simplesamlphp,項目名稱:simplesamlphp,代碼行數:20,代碼來源:SP.php

示例2: redirectUntrustedURL

 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::redirectUntrustedURL() instead.
  */
 public static function redirectUntrustedURL($url, $parameters = array())
 {
     \SimpleSAML\Utils\HTTP::redirectUntrustedURL($url, $parameters);
 }
開發者ID:jstormes,項目名稱:simplesamlphp,代碼行數:7,代碼來源:Utilities.php

示例3: loadState

 /**
  * Retrieve saved state.
  *
  * This function retrieves saved state information. If the state information has been lost,
  * it will attempt to restart the request by calling the restart URL which is embedded in the
  * state information. If there is no restart information available, an exception will be thrown.
  *
  * @param string $id  State identifier (with embedded restart information).
  * @param string $stage  The stage the state should have been saved in.
  * @param bool $allowMissing  Whether to allow the state to be missing.
  * @return array|NULL  State information, or NULL if the state is missing and $allowMissing is TRUE.
  */
 public static function loadState($id, $stage, $allowMissing = FALSE)
 {
     assert('is_string($id)');
     assert('is_string($stage)');
     assert('is_bool($allowMissing)');
     SimpleSAML_Logger::debug('Loading state: ' . var_export($id, TRUE));
     $sid = self::parseStateID($id);
     $session = SimpleSAML_Session::getSessionFromRequest();
     $state = $session->getData('SimpleSAML_Auth_State', $sid['id']);
     if ($state === NULL) {
         /* Could not find saved data. */
         if ($allowMissing) {
             return NULL;
         }
         if ($sid['url'] === NULL) {
             throw new SimpleSAML_Error_NoState();
         }
         \SimpleSAML\Utils\HTTP::redirectUntrustedURL($sid['url']);
     }
     $state = unserialize($state);
     assert('is_array($state)');
     assert('array_key_exists(self::ID, $state)');
     assert('array_key_exists(self::STAGE, $state)');
     /* Verify stage. */
     if ($state[self::STAGE] !== $stage) {
         /* This could be a user trying to bypass security, but most likely it is just
          * someone using the back-button in the browser. We try to restart the
          * request if that is possible. If not, show an error.
          */
         $msg = 'Wrong stage in state. Was \'' . $state[self::STAGE] . '\', should be \'' . $stage . '\'.';
         SimpleSAML_Logger::warning($msg);
         if ($sid['url'] === NULL) {
             throw new Exception($msg);
         }
         \SimpleSAML\Utils\HTTP::redirectUntrustedURL($sid['url']);
     }
     return $state;
 }
開發者ID:tractorcow,項目名稱:simplesamlphp,代碼行數:50,代碼來源:State.php

示例4: SimpleSAML_Error_BadRequest

<?php

/*
 * Helper page for starting a admin login. Can be used as a target for links.
 */
if (!array_key_exists('ReturnTo', $_REQUEST)) {
    throw new SimpleSAML_Error_BadRequest('Missing ReturnTo parameter.');
}
SimpleSAML\Utils\Auth::requireAdmin();
\SimpleSAML\Utils\HTTP::redirectUntrustedURL($_REQUEST['ReturnTo']);
開發者ID:PitcherAG,項目名稱:simplesamlphp,代碼行數:10,代碼來源:login-admin.php


注:本文中的SimpleSAML\Utils\HTTP::redirectUntrustedURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。