vendor/bshaffer/oauth2-server-bundle/OAuth2/ServerBundle/Storage/ClientCredentials.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace OAuth2\ServerBundle\Storage;
use OAuth2\Storage\ClientCredentialsInterface;
use Doctrine\ORM\EntityManager;
use OAuth2\ServerBundle\Entity\Client;
class ClientCredentials implements ClientCredentialsInterface
{
private $em;
public function __construct(EntityManager $EntityManager)
{
$this->em = $EntityManager;
}
/**
* Make sure that the client credentials is valid.
*
* @param $client_id
* Client identifier to be check with.
* @param $client_secret
* (optional) If a secret is required, check that they've given the right one.
*
* @return
* TRUE if the client credentials are valid, and MUST return FALSE if it isn't.
* @endcode
*
* @see http://tools.ietf.org/html/rfc6749#section-3.1
*
* @ingroup oauth2_section_3
*/
public function checkClientCredentials($client_id, $client_secret = null)
{
// Get Client
$client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);
// If client exists check secret
if ($client) {
return $client->getClientSecret() === $client_secret;
}
return false;
}
/**
* Get client details corresponding client_id.
*
* OAuth says we should store request URIs for each registered client.
* Implement this function to grab the stored URI for a given client id.
*
* @param $client_id
* Client identifier to be check with.
*
* @return array
* Client details. The only mandatory key in the array is "redirect_uri".
* This function MUST return FALSE if the given client does not exist or is
* invalid. "redirect_uri" can be space-delimited to allow for multiple valid uris.
* @code
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。