Docblock updates

This commit is contained in:
Alex Bilbie 2013-02-13 19:36:56 +00:00
parent d99002ef2f
commit 4506037bda
6 changed files with 93 additions and 2 deletions

View File

@ -1,7 +1,19 @@
<?php <?php
/**
* OAuth 2.0 Client Exception
*
* @package lncd/oauth2
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 University of Lincoln
* @license http://mit-license.org/
* @link http://github.com/lncd/oauth2
*/
namespace OAuth2\Exception; namespace OAuth2\Exception;
/**
* ClientException Exception
*/
class ClientException extends OAuth2Exception class ClientException extends OAuth2Exception
{ {

View File

@ -1,7 +1,19 @@
<?php <?php
/**
* OAuth 2.0 Invalid Access Token Exception
*
* @package lncd/oauth2
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 University of Lincoln
* @license http://mit-license.org/
* @link http://github.com/lncd/oauth2
*/
namespace OAuth2\Exception; namespace OAuth2\Exception;
/**
* InvalidAccessToken Exception
*/
class InvalidAccessTokenException extends OAuth2Exception class InvalidAccessTokenException extends OAuth2Exception
{ {

View File

@ -1,7 +1,19 @@
<?php <?php
/**
* OAuth 2.0 Invalid Grant Type Exception
*
* @package lncd/oauth2
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 University of Lincoln
* @license http://mit-license.org/
* @link http://github.com/lncd/oauth2
*/
namespace OAuth2\Exception; namespace OAuth2\Exception;
/**
* InvalidGrantTypeException Exception
*/
class InvalidGrantTypeException extends OAuth2Exception class InvalidGrantTypeException extends OAuth2Exception
{ {

View File

@ -1,7 +1,19 @@
<?php <?php
/**
* OAuth 2.0 Base Exception
*
* @package lncd/oauth2
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 University of Lincoln
* @license http://mit-license.org/
* @link http://github.com/lncd/oauth2
*/
namespace OAuth2\Exception; namespace OAuth2\Exception;
/**
* Exception class
*/
class OAuth2Exception extends \Exception class OAuth2Exception extends \Exception
{ {

View File

@ -1,4 +1,13 @@
<?php <?php
/**
* OAuth 2.0 Auth code grant
*
* @package lncd/oauth2
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 University of Lincoln
* @license http://mit-license.org/
* @link http://github.com/lncd/oauth2
*/
namespace OAuth2\Grant; namespace OAuth2\Grant;
@ -10,26 +19,52 @@ use OAuth2\Storage\SessionInterface;
use OAuth2\Storage\ClientInterface; use OAuth2\Storage\ClientInterface;
use OAuth2\Storage\ScopeInterface; use OAuth2\Storage\ScopeInterface;
/**
* Auth code grant class
*/
class AuthCode implements GrantTypeInterface { class AuthCode implements GrantTypeInterface {
/**
* Grant identifier
* @var string
*/
protected $identifier = 'authorization_code'; protected $identifier = 'authorization_code';
/**
* Response type
* @var string
*/
protected $responseType = 'code'; protected $responseType = 'code';
/**
* Return the identifier
* @return string
*/
public function getIdentifier() public function getIdentifier()
{ {
return $this->identifier; return $this->identifier;
} }
/**
* Return the response type
* @return string
*/
public function getResponseType() public function getResponseType()
{ {
return $this->responseType; return $this->responseType;
} }
/**
* Complete the auth code grant
* @param null|array $inputParams
* @return array
*/
public function completeFlow($inputParams = null) public function completeFlow($inputParams = null)
{ {
// Get the required params
$authParams = AuthServer::getParam(array('client_id', 'client_secret', 'redirect_uri', 'code'), 'post', $inputParams); $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); throw new Exception\ClientException(sprintf(AuthServer::getExceptionMessage('invalid_request'), 'client_id'), 0);
} }

View File

@ -1,4 +1,13 @@
<?php <?php
/**
* OAuth 2.0 Grant type interface
*
* @package lncd/oauth2
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 University of Lincoln
* @license http://mit-license.org/
* @link http://github.com/lncd/oauth2
*/
namespace OAuth2\Grant; namespace OAuth2\Grant;
@ -39,7 +48,6 @@ interface GrantTypeInterface
* </code> * </code>
* *
* @param null|array $inputParams Null unless the input parameters have been manually set * @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 * @return array An array of parameters to be passed back to the client
*/ */
public function completeFlow($inputParams = null); public function completeFlow($inputParams = null);