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/AuthorizationCode.php | 48 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/AuthorizationCode.php') diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/AuthorizationCode.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/AuthorizationCode.php index cae9f787d..784f6b3a3 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/AuthorizationCode.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/AuthorizationCode.php @@ -6,29 +6,47 @@ use OAuth2\Storage\AuthorizationCodeInterface; use OAuth2\ResponseType\AccessTokenInterface; use OAuth2\RequestInterface; use OAuth2\ResponseInterface; +use Exception; /** - * * @author Brent Shaffer */ class AuthorizationCode implements GrantTypeInterface { + /** + * @var AuthorizationCodeInterface + */ protected $storage; + + /** + * @var array + */ protected $authCode; /** - * @param \OAuth2\Storage\AuthorizationCodeInterface $storage REQUIRED Storage class for retrieving authorization code information + * @param AuthorizationCodeInterface $storage - REQUIRED Storage class for retrieving authorization code information */ public function __construct(AuthorizationCodeInterface $storage) { $this->storage = $storage; } - public function getQuerystringIdentifier() + /** + * @return string + */ + public function getQueryStringIdentifier() { return 'authorization_code'; } + /** + * Validate the OAuth request + * + * @param RequestInterface $request + * @param ResponseInterface $response + * @return bool + * @throws Exception + */ public function validateRequest(RequestInterface $request, ResponseInterface $response) { if (!$request->request('code')) { @@ -75,21 +93,45 @@ class AuthorizationCode implements GrantTypeInterface return true; } + /** + * Get the client id + * + * @return mixed + */ public function getClientId() { return $this->authCode['client_id']; } + /** + * Get the scope + * + * @return string + */ public function getScope() { return isset($this->authCode['scope']) ? $this->authCode['scope'] : null; } + /** + * Get the user id + * + * @return mixed + */ public function getUserId() { return isset($this->authCode['user_id']) ? $this->authCode['user_id'] : 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) { $token = $accessToken->createAccessToken($client_id, $user_id, $scope); -- cgit v1.2.3