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


PHP SimpleSAML_Auth_State::getPersistentAuthData方法代码示例

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


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

示例1: testGetPersistentAuthData

 /**
  * Test the getPersistentAuthData() function.
  */
 public function testGetPersistentAuthData()
 {
     $mandatory = array('Attributes' => array(), 'Expire' => 1234, 'LogoutState' => 'logoutState', 'AuthInstant' => 123456, 'RememberMe' => true, 'saml:sp:NameID' => 'nameID');
     // check just mandatory parameters
     $state = $mandatory;
     $expected = $mandatory;
     $this->assertEquals($expected, SimpleSAML_Auth_State::getPersistentAuthData($state), 'Mandatory state attributes did not survive as expected' . print_r($expected, true));
     // check missing mandatory parameters
     unset($state['LogoutState']);
     unset($state['RememberMe']);
     $expected = $state;
     $this->assertEquals($expected, SimpleSAML_Auth_State::getPersistentAuthData($state), 'Some error occurred with missing mandatory parameters');
     // check additional non-persistent parameters
     $additional = array('additional1' => 1, 'additional2' => 2);
     $state = array_merge($mandatory, $additional);
     $expected = $mandatory;
     $this->assertEquals($expected, SimpleSAML_Auth_State::getPersistentAuthData($state), 'Additional parameters survived');
     // check additional persistent parameters
     $additional['PersistentAuthData'] = array('additional1');
     $state = array_merge($mandatory, $additional);
     $expected = $state;
     unset($expected['additional2']);
     unset($expected['PersistentAuthData']);
     $this->assertEquals($expected, SimpleSAML_Auth_State::getPersistentAuthData($state), 'Some error occurred with additional, persistent parameters');
     // check only additional persistent parameters
     $state = $additional;
     $expected = $state;
     unset($expected['additional2']);
     unset($expected['PersistentAuthData']);
     $this->assertEquals($expected, SimpleSAML_Auth_State::getPersistentAuthData($state), 'Some error occurred with additional, persistent parameters, and no mandatory ones');
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:34,代码来源:StateTest.php

示例2: loginCompleted

 /**
  * Called when a login operation has finished.
  *
  * This method never returns.
  *
  * @param array $state The state after the login has completed.
  */
 public static function loginCompleted($state)
 {
     assert('is_array($state)');
     assert('array_key_exists("SimpleSAML_Auth_Source.Return", $state)');
     assert('array_key_exists("SimpleSAML_Auth_Source.id", $state)');
     assert('array_key_exists("Attributes", $state)');
     assert('!array_key_exists("LogoutState", $state) || is_array($state["LogoutState"])');
     $return = $state['SimpleSAML_Auth_Source.Return'];
     // save session state
     $session = SimpleSAML_Session::getSessionFromRequest();
     $authId = $state['SimpleSAML_Auth_Source.id'];
     $session->doLogin($authId, SimpleSAML_Auth_State::getPersistentAuthData($state));
     if (is_string($return)) {
         // redirect...
         \SimpleSAML\Utils\HTTP::redirectTrustedURL($return);
     } else {
         call_user_func($return, $state);
     }
     assert('false');
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:27,代码来源:Source.php

示例3: 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

示例4: extractPersistentAuthState

 /**
  * @deprecated This method will be removed in SSP 2.0. Please use
  * SimpleSAML_Auth_State::getPersistentAuthData() instead.
  */
 public static function extractPersistentAuthState(array &$state)
 {
     return SimpleSAML_Auth_State::getPersistentAuthData($state);
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:8,代码来源:Default.php


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