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


PHP Entity\AccessTokenEntity類代碼示例

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


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

示例1: createEntity

 /**
  * @param AccessToken $accessToken
  *
  * @return AccessTokenEntity
  */
 protected function createEntity(AccessToken $accessToken)
 {
     $entity = new AccessTokenEntity($this->server);
     $entity->setId($accessToken->token);
     $entity->setExpireTime(Carbon::createFromFormat('Y-m-d H:i:s', $accessToken->expireTime)->getTimestamp());
     return $entity;
 }
開發者ID:nordsoftware,項目名稱:lumen-oauth2-dynamodb,代碼行數:12,代碼來源:AccessTokenStorage.php

示例2: 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->getToken(), 'oauth_access_tokens'))) {
         return null;
     }
     return $this->get($token['session_id']);
 }
開發者ID:fahmiardi,項目名稱:oauth2-server-redis,代碼行數:13,代碼來源:RedisSession.php

示例3: get

 /**
  * @inheritdoc
  */
 public function get($token)
 {
     $entity = new AccessTokenEntity($this->server);
     $entity->setId('mF_9.B5f-4.1JqM');
     $entity->setExpireTime(time() + 24 * 60 * 60);
     // NOW + 24h
     return $entity;
 }
開發者ID:nordsoftware,項目名稱:lumen-oauth2,代碼行數:11,代碼來源:MockAccessTokenStorage.php

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

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

 /**
  * 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

示例7: 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 = Config::get('couch.client')->useDatabase('oauth_sessions')->getDoc($accessToken->getSessionId());
     if (is_null($result)) {
         return;
     }
     config('session', $result);
     return (new SessionEntity($this->getServer()))->setId($result->_id)->setOwner($result->owner_type, $result->owner_id);
 }
開發者ID:redaigbaria,項目名稱:oauth2-cloudant,代碼行數:16,代碼來源:FluentSession.php

示例8: get

 public function get($token)
 {
     if ($token !== 'foo') {
         return null;
     }
     $token = new AccessTokenEntity($this->server);
     $token->setId('foo');
     $token->setExpireTime(time() + 3600);
     return $token;
 }
開發者ID:tonis-io,項目名稱:oauth2,代碼行數:10,代碼來源:AccessTokenStorage.php

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

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

 /**
  * {@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

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

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

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

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


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