Cheetah
ClientCredentials.php
Go to the documentation of this file.
1 <?php
2 
3 namespace OAuth2\GrantType;
4 
8 
15 {
16  private $clientData;
17 
18  public function __construct(ClientCredentialsInterface $storage, array $config = array())
19  {
25  $config['allow_public_clients'] = false;
26 
27  parent::__construct($storage, $config);
28  }
29 
30  public function getQuerystringIdentifier()
31  {
32  return 'client_credentials';
33  }
34 
35  public function getScope()
36  {
37  $this->loadClientData();
38 
39  return isset($this->clientData['scope']) ? $this->clientData['scope'] : null;
40  }
41 
42  public function getUserId()
43  {
44  $this->loadClientData();
45 
46  return isset($this->clientData['user_id']) ? $this->clientData['user_id'] : null;
47  }
48 
49  public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
50  {
56  $includeRefreshToken = false;
57 
58  return $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
59  }
60 
61  private function loadClientData()
62  {
63  if (!$this->clientData) {
64  $this->clientData = $this->storage->getClientDetails($this->getClientId());
65  }
66  }
67 }
OAuth2\GrantType\GrantTypeInterface
Definition: GrantTypeInterface.php:13
OAuth2\ClientAssertionType\HttpBasic
Definition: HttpBasic.php:15
OAuth2\GrantType\ClientCredentials
Definition: ClientCredentials.php:15
OAuth2\GrantType\ClientCredentials\getScope
getScope()
Definition: ClientCredentials.php:35
use
GNU LESSER GENERAL PUBLIC LICENSE February Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license but changing it is not allowed[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it By the GNU General Public Licenses are intended to guarantee your freedom to share and change free software to make sure the software is free for all its users This the Lesser General Public applies to some specially designated software packages typically libraries of the Free Software Foundation and other authors who decide to use it You can use it but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular based on the explanations below When we speak of free we are referring to freedom of use
Definition: license.txt:27
OAuth2\GrantType\ClientCredentials\createAccessToken
createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
Definition: ClientCredentials.php:49
OAuth2\GrantType
Definition: AuthorizationCode.php:3
php
OAuth2\ClientAssertionType\HttpBasic\$config
$config
Definition: HttpBasic.php:19
OAuth2\GrantType\ClientCredentials\getQuerystringIdentifier
getQuerystringIdentifier()
Definition: ClientCredentials.php:30
OAuth2\ResponseType\AccessTokenInterface
Definition: AccessTokenInterface.php:10
OAuth2\GrantType\ClientCredentials\__construct
__construct(ClientCredentialsInterface $storage, array $config=array())
Definition: ClientCredentials.php:18
OAuth2\ClientAssertionType\HttpBasic\getClientId
getClientId()
Definition: HttpBasic.php:73
OAuth2\Storage\ClientCredentialsInterface
Definition: ClientCredentialsInterface.php:12
OAuth2\ResponseType\AccessTokenInterface\createAccessToken
createAccessToken($client_id, $user_id, $scope=null, $includeRefreshToken=true)
OAuth2\ClientAssertionType\HttpBasic\$storage
$storage
Definition: HttpBasic.php:18
OAuth2\GrantType\ClientCredentials\getUserId
getUserId()
Definition: ClientCredentials.php:42