vendor/bshaffer/oauth2-server-bundle/OAuth2/ServerBundle/Manager/ClientManager.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace OAuth2\ServerBundle\Manager;
use Doctrine\ORM\EntityManager;
use OAuth2\ServerBundle\Exception\ScopeNotFoundException;
class ClientManager
{
private $em;
/**
* @var ScopeManagerInterface
*/
private $sm;
public function __construct(EntityManager $entityManager, ScopeManagerInterface $scopeManager)
{
$this->em = $entityManager;
$this->sm = $scopeManager;
}
/**
* Creates a new client
*
* @param string $identifier
*
* @param array $redirect_uris
*
* @param array $grant_type
*
* @param array $scopes
*
* @return Client
*/
public function createClient($identifier, array $redirect_uris = array(), array $grant_types = array(), array $scopes = array())
{
$client = new \OAuth2\ServerBundle\Entity\Client();
$client->setClientId($identifier);
$client->setClientSecret($this->generateSecret());
$client->setRedirectUri($redirect_uris);
$client->setGrantTypes($grant_types);
// Verify scopes
foreach ($scopes as $scope) {
// Get Scope
$scopeObject = $this->sm->findScopeByScope($scope);
if (!$scopeObject) {
throw new ScopeNotFoundException();
}
}
$client->setScopes($scopes);
// Store Client
$this->em->persist($client);
$this->em->flush();
return $client;
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。