vendor/bshaffer/oauth2-server-bundle/OAuth2/ServerBundle/Storage/AccessToken.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace OAuth2\ServerBundle\Storage;
use OAuth2\Storage\AccessTokenInterface;
use Doctrine\ORM\EntityManager;
use OAuth2\ServerBundle\Entity\Client;
class AccessToken implements AccessTokenInterface
{
private $em;
public function __construct(EntityManager $EntityManager)
{
$this->em = $EntityManager;
}
/**
* Look up the supplied oauth_token from storage.
*
* We need to retrieve access token data as we create and verify tokens.
*
* @param $oauth_token
* oauth_token to be check with.
*
* @return
* An associative array as below, and return NULL if the supplied oauth_token
* is invalid:
* - client_id: Stored client identifier.
* - expires: Stored expiration in unix timestamp.
* - scope: (optional) Stored scope values in space-separated string.
*
* @ingroup oauth2_section_7
*/
public function getAccessToken($oauth_token)
{
$accessToken = $this->em->getRepository('OAuth2ServerBundle:AccessToken')->find($oauth_token);
if (!$accessToken) {
return null;
}
// Get Client
$client = $accessToken->getClient();
return array(
'client_id' => $client->getClientId(),
'user_id' => $accessToken->getUserId(),
'expires' => $accessToken->getExpires()->getTimestamp(),
'scope' => $accessToken->getScope()
);
}
/**
* Store the supplied access token values to storage.
*
* We need to store access token data as we create and verify tokens.
*
* @param $oauth_token
* oauth_token to be stored.
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。