vendor/bshaffer/oauth2-server-bundle/OAuth2/ServerBundle/Storage/AuthorizationCode.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace OAuth2\ServerBundle\Storage;

use OAuth2\Storage\AuthorizationCodeInterface;
use Doctrine\ORM\EntityManager;
use OAuth2\ServerBundle\Entity\Client;

class AuthorizationCode implements AuthorizationCodeInterface
{
    private $em;

    public function __construct(EntityManager $EntityManager)
    {
        $this->em = $EntityManager;
    }

    /**
     * Fetch authorization code data (probably the most common grant type).
     *
     * Retrieve the stored data for the given authorization code.
     *
     * Required for OAuth2::GRANT_TYPE_AUTH_CODE.
     *
     * @param $code
     * Authorization code to be check with.
     *
     * @return
     * An associative array as below, and NULL if the code is invalid
     * @code
     * return array(
     *     "client_id"    => CLIENT_ID,      // REQUIRED Stored client identifier
     *     "user_id"      => USER_ID,        // REQUIRED Stored user identifier
     *     "expires"      => EXPIRES,        // REQUIRED Stored expiration in unix timestamp
     *     "redirect_uri" => REDIRECT_URI,   // REQUIRED Stored redirect URI
     *     "scope"        => SCOPE,          // OPTIONAL Stored scope values in space-separated string
     * );
     * @endcode
     *
     * @see http://tools.ietf.org/html/rfc6749#section-4.1
     *
     * @ingroup oauth2_section_4
     */
    public function getAuthorizationCode($code)
    {
        // Get Code
        $code = $this->em->getRepository('OAuth2ServerBundle:AuthorizationCode')->find($code);

        if (!$code) {
            return null;
        }

        return array(
            'client_id' => $code->getClient()->getClientId(),
            'user_id' => $code->getUserId(),
            'expires' => $code->getExpires()->getTimestamp(),
            'redirect_uri' => implode(' ', $code->getRedirectUri()),
            'scope' => $code->getScope()
        );
    }

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。