From 439d41b194073285ab97be94253b3f4cb4395e43 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 18 Dec 2017 15:48:49 +0100 Subject: install smarty via composer and update other php libs --- .../src/OAuth2/GrantType/UserCredentials.php | 46 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/UserCredentials.php') diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/UserCredentials.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/UserCredentials.php index f165538ba..b10c2dd09 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/UserCredentials.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/UserCredentials.php @@ -6,30 +6,46 @@ use OAuth2\Storage\UserCredentialsInterface; use OAuth2\ResponseType\AccessTokenInterface; use OAuth2\RequestInterface; use OAuth2\ResponseInterface; +use LogicException; /** - * * @author Brent Shaffer */ class UserCredentials implements GrantTypeInterface { + /** + * @var array + */ private $userInfo; + /** + * @var UserCredentialsInterface + */ protected $storage; /** - * @param OAuth2\Storage\UserCredentialsInterface $storage REQUIRED Storage class for retrieving user credentials information + * @param UserCredentialsInterface $storage - REQUIRED Storage class for retrieving user credentials information */ public function __construct(UserCredentialsInterface $storage) { $this->storage = $storage; } - public function getQuerystringIdentifier() + /** + * @return string + */ + public function getQueryStringIdentifier() { return 'password'; } + /** + * @param RequestInterface $request + * @param ResponseInterface $response + * @return bool|mixed|null + * + * @throws LogicException + */ public function validateRequest(RequestInterface $request, ResponseInterface $response) { if (!$request->request("password") || !$request->request("username")) { @@ -61,21 +77,45 @@ class UserCredentials implements GrantTypeInterface return true; } + /** + * Get client id + * + * @return mixed|null + */ public function getClientId() { return null; } + /** + * Get user id + * + * @return mixed + */ public function getUserId() { return $this->userInfo['user_id']; } + /** + * Get scope + * + * @return null|string + */ public function getScope() { return isset($this->userInfo['scope']) ? $this->userInfo['scope'] : null; } + /** + * Create access token + * + * @param AccessTokenInterface $accessToken + * @param mixed $client_id - client identifier related to the access token. + * @param mixed $user_id - user id associated with the access token + * @param string $scope - scopes to be stored in space-separated string. + * @return array + */ public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope) { return $accessToken->createAccessToken($client_id, $user_id, $scope); -- cgit v1.2.3