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


PHP AccessTokenEntity::getId方法代碼示例

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


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

示例1: getByAccessToken

 /**
  * Get a session from Redis storage by an associated access token.
  * 
  * @param  \League\OAuth2\Server\Entity\AccessTokenEntity  $accessToken
  * @return \League\OAuth2\Server\Entity\SessionEntity|null
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     if (!($token = $this->getValue($accessToken->getId(), 'oauth_access_tokens'))) {
         return null;
     }
     return $this->get($token['session_id']);
 }
開發者ID:yanguanglan,項目名稱:oauth2-storage-redis,代碼行數:13,代碼來源:RedisSession.php

示例2: getByAccessToken

 /**
  * Get a session from an access token
  *
  * @param AccessTokenEntity $accessToken
  * @return SessionEntity
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $result = $this->db->table('oauth_sessions')->select('oauth_sessions.*')->join('oauth_access_tokens', 'oauth_sessions.id', '=', 'oauth_access_tokens.session_id')->where('oauth_access_tokens.id', $accessToken->getId())->first();
     if (is_null($result)) {
         return;
     }
     return (new SessionEntity($this->getServer()))->setId($result->id)->setOwner($result->owner_type, $result->owner_id);
 }
開發者ID:koanreview,項目名稱:cribbb,代碼行數:14,代碼來源:SessionStorage.php

示例3: delete

 /**
  * @inheritdoc
  */
 public function delete(AccessTokenEntity $token)
 {
     $accessToken = $this->findByToken($token->getId());
     if ($accessToken === null) {
         throw new AccessTokenNotFound();
     }
     $accessToken->delete();
 }
開發者ID:nordsoftware,項目名稱:lumen-oauth2-dynamodb,代碼行數:11,代碼來源:AccessTokenStorage.php

示例4: getByAccessToken

 /**
  * Get a session from an access token
  * @param  \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token
  * @return \League\OAuth2\Server\Entity\SessionEntity
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $allowedSessionIds = $this->getConnection()->table('oauth_access_tokens')->where('id', $accessToken->getId())->pluck('session_id');
     $result = $this->getConnection()->table('oauth_sessions')->whereIn('id', $allowedSessionIds)->first();
     if (is_null($result)) {
         return null;
     }
     return (new SessionEntity($this->getServer()))->setId($result['id'])->setOwner($result['owner_type'], $result['owner_id']);
 }
開發者ID:khalidnrgedge,項目名稱:oauth2-server-laravel,代碼行數:14,代碼來源:FluentSession.php

示例5: getByAccessToken

 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     if ($accessToken->getId() !== 'foo') {
         return null;
     }
     $session = new SessionEntity($this->server);
     $session->setId('foo');
     return $session;
 }
開發者ID:tonis-io,項目名稱:oauth2,代碼行數:9,代碼來源:SessionStorage.php

示例6: getByAccessToken

 /**
  * @inheritdoc
  */
 public function getByAccessToken(AccessTokenEntity $entity)
 {
     $accessToken = AccessToken::findByToken($entity->getId());
     /** @var Session $session */
     $session = Session::find($accessToken->sessionId);
     if ($session === null) {
         throw new SessionNotFound();
     }
     return $this->createEntity($session);
 }
開發者ID:nordsoftware,項目名稱:lumen-oauth2-dynamodb,代碼行數:13,代碼來源:SessionStorage.php

示例7: getByAccessToken

 /**
  * {@inheritdoc}
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $result = M('oauth_sessions')->field('oauth_sessions.id, oauth_sessions.owner_type, oauth_sessions.owner_id, oauth_sessions.client_id, oauth_sessions.client_redirect_uri')->join('LEFT JOIN oauth_access_tokens ON oauth_access_tokens.session_id = oauth_sessions.id')->where(array('oauth_access_tokens.access_token' => $accessToken->getId()))->select();
     if (count($result) === 1) {
         $session = new SessionEntity($this->server);
         $session->setId($result[0]['id']);
         $session->setOwner($result[0]['owner_type'], $result[0]['owner_id']);
         return $session;
     }
     return;
 }
開發者ID:lizongying,項目名稱:thinkphp-oauth,代碼行數:14,代碼來源:SessionStorage.class.php

示例8: getByAccessToken

 /**
  * Get a session from an access token
  * @param  \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token
  * @return \League\OAuth2\Server\Entity\SessionEntity
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $result = $this->db->fetchAll("SELECT s.id, s.owner_type, s.owner_id, s.client_id, s.client_redirect_uri FROM oauth_sessions s " . "JOIN oauth_access_tokens t ON t.session_id = s.id " . "WHERE t.access_token = ?", Db::FETCH_ASSOC, [$accessToken->getId()]);
     if (count($result) === 1) {
         $session = new SessionEntity($this->server);
         $session->setId($result[0]['id']);
         $session->setOwner($result[0]['owner_type'], $result[0]['owner_id']);
         return $session;
     }
     return NULL;
 }
開發者ID:serviceCuCu91,項目名稱:PhalconOauth2RESTfulServer,代碼行數:16,代碼來源:Session.php

示例9: getByAccessToken

 /**
  * {@inheritdoc}
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $result = $this->getConnection()->table('oauth_sessions')->select(['oauth_sessions.id', 'oauth_sessions.owner_type', 'oauth_sessions.owner_id', 'oauth_sessions.client_id', 'oauth_sessions.client_redirect_uri'])->join('oauth_access_tokens', 'oauth_access_tokens.session_id', '=', 'oauth_sessions.id')->where('oauth_access_tokens.access_token', $accessToken->getId())->first();
     if (!is_null($result)) {
         $session = new SessionEntity($this->server);
         $session->setId($result->id);
         $session->setOwner($result->owner_type, $result->owner_id);
         return $session;
     }
     return;
 }
開發者ID:avlima,項目名稱:oauth2server-lumen,代碼行數:14,代碼來源:SessionStorage.php

示例10: getByAccessToken

 /**
  * {@inheritdoc}
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $result = DB::table('oauth_sessions')->select(['oauth_sessions.id', 'oauth_sessions.owner_type', 'oauth_sessions.owner_id', 'oauth_sessions.client_id', 'oauth_sessions.client_redirect_uri'])->join('oauth_access_tokens', 'oauth_access_tokens.session_id', '=', 'oauth_sessions.id')->where('oauth_access_tokens.access_token', $accessToken->getId())->get();
     if (count($result) === 1) {
         $session = new SessionEntity($this->server);
         $session->setId($result[0]->id);
         $session->setOwner($result[0]->owner_type, $result[0]->owner_id);
         return $session;
     }
     return null;
 }
開發者ID:glgeorgiev,項目名稱:laravel-oauth2-server,代碼行數:14,代碼來源:SessionStorage.php

示例11: getByAccessToken

 public function getByAccessToken(AccessTokenEntity $access_token)
 {
     $sql = 'SELECT oauth_sessions.id, oauth_sessions.owner_type,' . ' oauth_sessions.owner_id, oauth_sessions.client_id,' . ' oauth_sessions.client_redirect_uri' . ' FROM oauth_sessions' . ' INNER JOIN oauth_access_tokens' . ' ON oauth_access_tokens.session_id = oauth_sessions.id' . ' WHERE oauth_access_tokens.access_token = ?;';
     $results = $this->db->fetch($sql, [$access_token->getId()]);
     if (count($results) === 1) {
         $session = new SessionEntity($this->server);
         $session->setId($result[0]['id']);
         $session->setOwner($result[0]['owner_type'], $result[0]['owner_id']);
         return $session;
     }
     return null;
 }
開發者ID:joshtronic,項目名稱:pickles,代碼行數:12,代碼來源:SessionStorage.php

示例12: getByAccessToken

 /**
  * {@inheritdoc}
  */
 public function getByAccessToken(AccessTokenEntity $accessTokenEntity)
 {
     /** @var AccessToken $accessToken */
     $accessToken = $this->dm->getRepository(AccessToken::class)->find($accessTokenEntity->getId());
     if ($accessToken === null) {
         return null;
     }
     $session = $accessToken->getSession();
     $sessionEntity = new SessionEntity($this->server);
     $sessionEntity->setId($session->getId());
     $sessionEntity->setOwner($session->getOwnerType(), $session->getOwnerId());
     return $sessionEntity;
 }
開發者ID:gobudgit,項目名稱:gobudgit,代碼行數:16,代碼來源:SessionStorage.php

示例13: getByAccessToken

 /**
  * {@inheritdoc}
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $query = $this->db->createQueryBuilder()->select('s.id', 's.owner_type', 's.owner_id')->from('oauth_sessions', 's')->join('s', 'oauth_access_tokens', 'at', 's.id = at.session_id')->where('at.access_token = :accessToken');
     $query->createNamedParameter($accessToken->getId(), \PDO::PARAM_STR, ':accessToken');
     $stmt = $query->execute();
     $result = $stmt->fetchAll();
     if (count($result) === 1) {
         $session = new SessionEntity($this->server);
         $session->setId($result[0]['id']);
         $session->setOwner($result[0]['owner_type'], $result[0]['owner_id']);
         return $session;
     }
 }
開發者ID:bitExpert,項目名稱:oauth2-server-storage-dbal,代碼行數:16,代碼來源:SessionStorage.php

示例14: getByAccessToken

 /**
  * {@inheritdoc}
  *
  * @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken Access token
  * @return \League\OAuth2\Server\Entity\SessionEntity
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $this->loadModel('OAuthServer.Sessions');
     $result = $this->Sessions->find()->matching('AccessTokens', function ($q) use($accessToken) {
         return $q->where(['oauth_token' => $accessToken->getId()]);
     })->first();
     if ($result) {
         $session = new SessionEntity($this->server);
         $session->setId($result->id);
         $session->setOwner($result->owner_model, $result->owner_id);
         return $session;
     }
 }
開發者ID:laughingpain,項目名稱:oauth-server,代碼行數:19,代碼來源:SessionStorage.php

示例15: getByAccessToken

 /**
  * {@inheritdoc}
  */
 public function getByAccessToken(AccessTokenEntity $accessToken)
 {
     $key = RedisUtil::prefix($accessToken->getId(), 'oauth_access_tokens');
     if (isset($this->cache[$key])) {
         $result = $this->cache[$key];
     } else {
         if (!($value = RedisCapsule::get($key))) {
             return;
         }
         $result = $this->cache[$key] = RedisUtil::unserialize($value);
     }
     return $this->getSession($result['session_id']);
 }
開發者ID:fahmiardi,項目名稱:oauth2-server-storage-redis,代碼行數:16,代碼來源:RedisSession.php


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