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


PHP Auth_OpenID_Association::getExpiresIn方法代碼示例

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


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

示例1: getAssociation

 /**
  * Get an association
  * 
  * @param string $server_url The identity server endpoint
  * @param string $handle     The association handle
  * @return Auth_OpenID_Association
  */
 public function getAssociation($server_url, $handle = null)
 {
     $assocs = $this->getAssociations($server_url, $handle);
     if (!$assocs || count($assocs) == 0) {
         return null;
     } else {
         $associations = array();
         foreach ($assocs as $object) {
             $assoc = new Auth_OpenID_Association($object->handle, base64_decode($object->secret), $object->issued, $object->lifetime, $object->assoc_type);
             if ($assoc->getExpiresIn() == 0) {
                 $this->removeAssociation($server_url, $assoc->handle);
             } else {
                 $associations[] = array($assoc->issued, $assoc);
             }
         }
         if ($associations) {
             $issued = array();
             $assocs = array();
             foreach ($associations as $key => $assoc) {
                 $issued[$key] = $assoc[0];
                 $assocs[$key] = $assoc[1];
             }
             array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, $associations);
             // return the most recently issued one.
             list($issued, $assoc) = $associations[0];
             return $assoc;
         } else {
             return null;
         }
     }
 }
開發者ID:lorea,項目名稱:Hydra-dev,代碼行數:38,代碼來源:OpenID_ElggStore.php

示例2: getAssociation

 function getAssociation($server_url, $handle = null)
 {
     if (isset($handle)) {
         $meta_array = array('server_url' => $server_url, 'handle' => $handle);
         $assocs = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => $meta_array, 'types' => 'object', 'subtypes' => 'openid_client::association', 'metadata_name_value_pairs_operator' => 'and'));
     } else {
         $assocs = elgg_get_entities_from_metadata(array('metadata_names' => 'server_url', 'metadata_values' => $server_url, 'types' => 'object', 'subtypes' => 'openid_client::association', 'metadata_case_sensitive' => FALSE));
     }
     if (!$assocs || count($assocs) == 0) {
         return null;
     } else {
         $associations = array();
         foreach ($assocs as $assoc_row) {
             $assoc = new Auth_OpenID_Association($assoc_row->handle, base64_decode($assoc_row->secret), $assoc_row->issued, $assoc_row->lifetime, $assoc_row->assoc_type);
             if ($assoc->getExpiresIn() == 0) {
                 OpenIDServer_ElggStore::removeAssociation($server_url, $assoc->handle);
             } else {
                 $associations[] = array($assoc->issued, $assoc);
             }
         }
         if ($associations) {
             $issued = array();
             $assocs = array();
             foreach ($associations as $key => $assoc) {
                 $issued[$key] = $assoc[0];
                 $assocs[$key] = $assoc[1];
             }
             array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, $associations);
             // return the most recently issued one.
             list($issued, $assoc) = $associations[0];
             return $assoc;
         } else {
             return null;
         }
     }
 }
開發者ID:lorea,項目名稱:Hydra-dev,代碼行數:36,代碼來源:openid_server_include.php

示例3: getAssociation

 function getAssociation($server_url, $handle = null)
 {
     if ($handle !== null) {
         $assoc = $this->_get_assoc($server_url, $handle);
         $assocs = array();
         if ($assoc) {
             $assocs[] = $assoc;
         }
     } else {
         $assocs = $this->_get_assocs($server_url);
     }
     if (!$assocs || count($assocs) == 0) {
         return null;
     } else {
         $associations = array();
         foreach ($assocs as $assoc_row) {
             $assoc = new Auth_OpenID_Association($assoc_row['handle'], $assoc_row['secret'], $assoc_row['issued'], $assoc_row['lifetime'], $assoc_row['assoc_type']);
             $assoc->secret = $this->blobDecode($assoc->secret);
             if ($assoc->getExpiresIn() == 0) {
                 $this->removeAssociation($server_url, $assoc->handle);
             } else {
                 $associations[] = array($assoc->issued, $assoc);
             }
         }
         if ($associations) {
             $issued = array();
             $assocs = array();
             foreach ($associations as $key => $assoc) {
                 $issued[$key] = $assoc[0];
                 $assocs[$key] = $assoc[1];
             }
             array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, $associations);
             // return the most recently issued one.
             list($issued, $assoc) = $associations[0];
             return $assoc;
         } else {
             return null;
         }
     }
 }
開發者ID:Mr-Robota,項目名稱:TYPO3.CMS,代碼行數:40,代碼來源:SQLStore.php

示例4: time

 function test_expiredAssoc()
 {
     // Store an expired association for the server with the handle
     // that is in the query
     $issued = time() - 10;
     $lifetime = 0;
     $handle = 'handle';
     $assoc = new Auth_OpenID_Association($handle, 'secret', $issued, $lifetime, 'HMAC-SHA1');
     $this->assertTrue($assoc->getExpiresIn() <= 0);
     $this->store->storeAssociation($this->server_url, $assoc);
     $query = array('openid.return_to' => $this->return_to, 'openid.identity' => $this->server_id, 'openid.sig' => 'bogus', 'openid.signed' => 'identity,return_to', 'openid.assoc_handle' => $handle);
     $message = Auth_OpenID_Message::fromPostArgs($query);
     $this->consumer->disableReturnToChecking();
     $info = $this->_doIdRes($message, $this->endpoint, null);
     $this->assertEquals('failure', $info->status);
     $this->assertTrue(strpos($info->message, 'expired') !== false);
 }
開發者ID:umbecr,項目名稱:camilaframework,代碼行數:17,代碼來源:Consumer.php

示例5: time

 function test_expiredAssoc()
 {
     // Store an expired association for the server with the handle
     // that is in the query
     $issued = time() - 10;
     $lifetime = 0;
     $handle = 'handle';
     $assoc = new Auth_OpenID_Association($handle, 'secret', $issued, $lifetime, 'HMAC-SHA1');
     $this->assertTrue($assoc->getExpiresIn() <= 0);
     $this->store->storeAssociation($this->server_url, $assoc);
     $query = array('openid.return_to' => $this->return_to, 'openid.identity' => $this->server_id, 'openid.assoc_handle' => $handle);
     $info = $this->_doIdRes($query);
     $this->assertEquals('failure', $info->status);
     $this->assertEquals($this->consumer_id, $info->identity_url);
     $this->assertTrue(strpos($info->message, 'expired') !== false);
 }
開發者ID:aprilchild,項目名稱:aprilchild,代碼行數:16,代碼來源:Consumer.php


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