diff --git a/src/OAuth2/Exception/ClientException.php b/src/OAuth2/Exception/ClientException.php index 0a732431..cfd8090a 100644 --- a/src/OAuth2/Exception/ClientException.php +++ b/src/OAuth2/Exception/ClientException.php @@ -1,7 +1,19 @@ + * @copyright Copyright (c) 2013 University of Lincoln + * @license http://mit-license.org/ + * @link http://github.com/lncd/oauth2 + */ namespace OAuth2\Exception; +/** + * ClientException Exception + */ class ClientException extends OAuth2Exception { diff --git a/src/OAuth2/Exception/InvalidAccessTokenException.php b/src/OAuth2/Exception/InvalidAccessTokenException.php index a7240992..fa598bd6 100644 --- a/src/OAuth2/Exception/InvalidAccessTokenException.php +++ b/src/OAuth2/Exception/InvalidAccessTokenException.php @@ -1,7 +1,19 @@ + * @copyright Copyright (c) 2013 University of Lincoln + * @license http://mit-license.org/ + * @link http://github.com/lncd/oauth2 + */ namespace OAuth2\Exception; +/** + * InvalidAccessToken Exception + */ class InvalidAccessTokenException extends OAuth2Exception { diff --git a/src/OAuth2/Exception/InvalidGrantTypeException.php b/src/OAuth2/Exception/InvalidGrantTypeException.php index 08b31e6a..4cf5c99f 100644 --- a/src/OAuth2/Exception/InvalidGrantTypeException.php +++ b/src/OAuth2/Exception/InvalidGrantTypeException.php @@ -1,7 +1,19 @@ + * @copyright Copyright (c) 2013 University of Lincoln + * @license http://mit-license.org/ + * @link http://github.com/lncd/oauth2 + */ namespace OAuth2\Exception; +/** + * InvalidGrantTypeException Exception + */ class InvalidGrantTypeException extends OAuth2Exception { diff --git a/src/OAuth2/Exception/OAuth2Exception.php b/src/OAuth2/Exception/OAuth2Exception.php index df4b6bb8..ad294199 100644 --- a/src/OAuth2/Exception/OAuth2Exception.php +++ b/src/OAuth2/Exception/OAuth2Exception.php @@ -1,7 +1,19 @@ + * @copyright Copyright (c) 2013 University of Lincoln + * @license http://mit-license.org/ + * @link http://github.com/lncd/oauth2 + */ namespace OAuth2\Exception; +/** + * Exception class + */ class OAuth2Exception extends \Exception { diff --git a/src/OAuth2/Grant/AuthCode.php b/src/OAuth2/Grant/AuthCode.php index 9760694e..38c0316c 100644 --- a/src/OAuth2/Grant/AuthCode.php +++ b/src/OAuth2/Grant/AuthCode.php @@ -1,4 +1,13 @@ + * @copyright Copyright (c) 2013 University of Lincoln + * @license http://mit-license.org/ + * @link http://github.com/lncd/oauth2 + */ namespace OAuth2\Grant; @@ -10,26 +19,52 @@ use OAuth2\Storage\SessionInterface; use OAuth2\Storage\ClientInterface; use OAuth2\Storage\ScopeInterface; +/** + * Auth code grant class + */ class AuthCode implements GrantTypeInterface { + /** + * Grant identifier + * @var string + */ protected $identifier = 'authorization_code'; + + /** + * Response type + * @var string + */ protected $responseType = 'code'; + /** + * Return the identifier + * @return string + */ public function getIdentifier() { return $this->identifier; } + /** + * Return the response type + * @return string + */ public function getResponseType() { return $this->responseType; } + /** + * Complete the auth code grant + * @param null|array $inputParams + * @return array + */ public function completeFlow($inputParams = null) { + // Get the required params $authParams = AuthServer::getParam(array('client_id', 'client_secret', 'redirect_uri', 'code'), 'post', $inputParams); - if (is_null($authParams['client_id'])) { + if (is_null($authParams['client_id'])) { throw new Exception\ClientException(sprintf(AuthServer::getExceptionMessage('invalid_request'), 'client_id'), 0); } diff --git a/src/OAuth2/Grant/GrantTypeInterface.php b/src/OAuth2/Grant/GrantTypeInterface.php index e9444537..b05c959e 100644 --- a/src/OAuth2/Grant/GrantTypeInterface.php +++ b/src/OAuth2/Grant/GrantTypeInterface.php @@ -1,4 +1,13 @@ + * @copyright Copyright (c) 2013 University of Lincoln + * @license http://mit-license.org/ + * @link http://github.com/lncd/oauth2 + */ namespace OAuth2\Grant; @@ -39,7 +48,6 @@ interface GrantTypeInterface * * * @param null|array $inputParams Null unless the input parameters have been manually set - * @param array $authParams The authorisation paramaters that have been set so far in the request * @return array An array of parameters to be passed back to the client */ public function completeFlow($inputParams = null);