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


PHP ISession::getId方法代碼示例

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


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

示例1: create

 /**
  * @NoAdminRequired
  * @NoSubadminRequired
  *
  * @return JSONResponse
  */
 public function create($name)
 {
     try {
         $sessionId = $this->session->getId();
     } catch (SessionNotAvailableException $ex) {
         $resp = new JSONResponse();
         $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE);
         return $resp;
     }
     try {
         $sessionToken = $this->tokenProvider->getToken($sessionId);
         $loginName = $sessionToken->getLoginName();
         try {
             $password = $this->tokenProvider->getPassword($sessionToken, $sessionId);
         } catch (PasswordlessTokenException $ex) {
             $password = null;
         }
     } catch (InvalidTokenException $ex) {
         $resp = new JSONResponse();
         $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE);
         return $resp;
     }
     $token = $this->generateRandomDeviceToken();
     $deviceToken = $this->tokenProvider->generateToken($token, $this->uid, $loginName, $password, $name, IToken::PERMANENT_TOKEN);
     return ['token' => $token, 'deviceToken' => $deviceToken];
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:32,代碼來源:AuthSettingsController.php

示例2: updateSessionTokenPassword

 /**
  * Update password of the browser session token if there is one
  *
  * @param string $password
  */
 public function updateSessionTokenPassword($password)
 {
     try {
         $sessionId = $this->session->getId();
         $token = $this->tokenProvider->getToken($sessionId);
         $this->tokenProvider->setPassword($token, $sessionId, $password);
     } catch (SessionNotAvailableException $ex) {
         // Nothing to do
     } catch (InvalidTokenException $ex) {
         // Nothing to do
     }
 }
開發者ID:drognisep,項目名稱:Portfolio-Site,代碼行數:17,代碼來源:Session.php

示例3: logout

 /**
  * logout the user from the session
  */
 public function logout()
 {
     $this->manager->emit('\\OC\\User', 'logout');
     $user = $this->getUser();
     if (!is_null($user)) {
         try {
             $this->tokenProvider->invalidateToken($this->session->getId());
         } catch (SessionNotAvailableException $ex) {
         }
     }
     $this->setUser(null);
     $this->setLoginName(null);
     $this->unsetMagicInCookie();
     $this->session->clear();
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:18,代碼來源:Session.php

示例4: create

 /**
  * @NoAdminRequired
  * @NoSubadminRequired
  *
  * @return JSONResponse
  */
 public function create($name)
 {
     try {
         $sessionId = $this->session->getId();
     } catch (SessionNotAvailableException $ex) {
         return $this->getServiceNotAvailableResponse();
     }
     try {
         $sessionToken = $this->tokenProvider->getToken($sessionId);
         $loginName = $sessionToken->getLoginName();
         try {
             $password = $this->tokenProvider->getPassword($sessionToken, $sessionId);
         } catch (PasswordlessTokenException $ex) {
             $password = null;
         }
     } catch (InvalidTokenException $ex) {
         return $this->getServiceNotAvailableResponse();
     }
     $token = $this->generateRandomDeviceToken();
     $deviceToken = $this->tokenProvider->generateToken($token, $this->uid, $loginName, $password, $name, IToken::PERMANENT_TOKEN);
     return ['token' => $token, 'loginName' => $loginName, 'deviceToken' => $deviceToken];
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:28,代碼來源:AuthSettingsController.php

示例5: getId

 /**
  * Wrapper around session_id
  *
  * @return string
  * @throws SessionNotAvailableException
  * @since 9.1.0
  */
 public function getId()
 {
     return $this->session->getId();
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:11,代碼來源:CryptoSessionData.php


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