Merge pull request #254 from bajb/master

Docbloc improvements
This commit is contained in:
Alex Bilbie 2014-11-13 12:37:20 +00:00
commit 35369038db
22 changed files with 48 additions and 31 deletions

View File

@ -188,7 +188,7 @@ abstract class AbstractServer
/**
* Set the refresh token storage
* @param \League\OAuth2\Server\Storage\RefreshTokenInteface $storage
* @param \League\OAuth2\Server\Storage\RefreshTokenInterface $storage
* @return self
*/
public function setRefreshTokenStorage(RefreshTokenInterface $storage)
@ -201,7 +201,7 @@ abstract class AbstractServer
/**
* Set the auth code storage
* @param \League\OAuth2\Server\Storage\AuthCodeInterface $authCode
* @param \League\OAuth2\Server\Storage\AuthCodeInterface $storage
* @return self
*/
public function setAuthCodeStorage(AuthCodeInterface $storage)

View File

@ -144,7 +144,7 @@ class AuthorizationServer extends AbstractServer
/**
* Default scope to be used if none is provided and requireScopeParam() is false
* @param string $default Name of the default scope
* @param self
* @return self
*/
public function setDefaultScope($default = null)
{
@ -164,8 +164,7 @@ class AuthorizationServer extends AbstractServer
/**
* Require the "state" paremter in checkAuthoriseParams()
* @param boolean $require
* @return void
* @return bool
*/
public function stateParamRequired()
{
@ -175,7 +174,7 @@ class AuthorizationServer extends AbstractServer
/**
* Require the "state" paremter in checkAuthoriseParams()
* @param boolean $require
* @return void
* @return self
*/
public function requireStateParam($require = true)
{
@ -196,6 +195,7 @@ class AuthorizationServer extends AbstractServer
/**
* Set the scope delimiter
* @param string $scopeDelimeter
* @return self
*/
public function setScopeDelimeter($scopeDelimeter = ' ')
{
@ -216,6 +216,7 @@ class AuthorizationServer extends AbstractServer
/**
* Set the TTL for an access token
* @param int $accessTokenTTL The new TTL
* @return self
*/
public function setAccessTokenTTL($accessTokenTTL = 3600)
{
@ -227,6 +228,7 @@ class AuthorizationServer extends AbstractServer
/**
* Issue an access token
* @return array Authorise request parameters
* @throws
*/
public function issueAccessToken()
{
@ -248,6 +250,7 @@ class AuthorizationServer extends AbstractServer
* Return a grant type class
* @param string $grantType The grant type identifer
* @return Grant\GrantTypeInterface
* @throws
*/
public function getGrantType($grantType)
{

View File

@ -105,7 +105,7 @@ abstract class AbstractTokenEntity
/**
* Set token ID
* @param string $token Token ID
* @param string $id Token ID
* @return self
*/
public function setId($id = null)

View File

@ -47,7 +47,7 @@ class AccessTokenEntity extends AbstractTokenEntity
/**
* Return all scopes associated with the access token
* @return \League\OAuth2\Server\Entity\Scope[]
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
*/
public function getScopes()
{

View File

@ -77,7 +77,7 @@ class AuthCodeEntity extends AbstractTokenEntity
/**
* Return all scopes associated with the session
* @return \League\OAuth2\Server\Entity\Scope[]
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
*/
public function getScopes()
{

View File

@ -16,6 +16,7 @@ trait EntityTrait
/**
* Hydrate an entity with properites
* @param array $properties
* @return self
*/
public function hydrate(array $properties)
{

View File

@ -30,7 +30,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
/**
* Set the ID of the associated access token
* @param string $accessToken
* @param string $accessTokenId
* @return self
*/
public function setAccessTokenId($accessTokenId)
@ -42,7 +42,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
/**
* Associate an access token
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessTokenEntity
* @return self
*/
public function setAccessToken(AccessTokenEntity $accessTokenEntity)
@ -54,7 +54,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
/**
* Return access token
* @return AccessToken
* @return AccessTokenEntity
*/
public function getAccessToken()
{

View File

@ -137,7 +137,7 @@ class SessionEntity
/**
* Return all scopes associated with the session
* @return \League\OAuth2\Server\Entity\Scope[]
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
*/
public function getScopes()
{

View File

@ -24,7 +24,7 @@ class ClientAuthenticationFailedEvent extends AbstractEvent
/**
* Init the event with a request
* @param \Symfony\Component\HttpFoundation\Requesty $request
* @param \Symfony\Component\HttpFoundation\Request $request
*/
public function __construct(Request $request)
{

View File

@ -24,7 +24,7 @@ class UserAuthenticationFailedEvent extends AbstractEvent
/**
* Init the event with a request
* @param \Symfony\Component\HttpFoundation\Requesty $request
* @param \Symfony\Component\HttpFoundation\Request $request
*/
public function __construct(Request $request)
{

View File

@ -36,6 +36,7 @@ class OAuthException extends \Exception
/**
* Throw a new exception
* @param string $msg Exception Message
*/
public function __construct($msg = 'An error occured')
{

View File

@ -125,6 +125,7 @@ abstract class AbstractGrant implements GrantTypeInterface
* @param string|null $redirectUri The redirect URI to return the user to
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
* @throws \League\OAuth2\Server\Exception\InvalidScopeException If scope is invalid, or no scopes passed when required
* @throws
*/
public function validateScopes($scopeParam = '', ClientEntity $client, $redirectUri = null)
{

View File

@ -18,7 +18,6 @@ use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Util\SecureKey;
/**
@ -40,7 +39,7 @@ class AuthCodeGrant extends AbstractGrant
/**
* AuthServer instance
* @var AuthServer
* @var \League\OAuth2\Server\AuthorizationServer
*/
protected $server = null;
@ -70,6 +69,8 @@ class AuthCodeGrant extends AbstractGrant
* Check authorize parameters
*
* @return array Authorize request parameters
*
* @throws
*/
public function checkAuthorizeParams()
{
@ -160,6 +161,7 @@ class AuthCodeGrant extends AbstractGrant
/**
* Complete the auth code grant
* @return array
* @throws
*/
public function completeFlow()
{
@ -257,7 +259,7 @@ class AuthCodeGrant extends AbstractGrant
$accessToken->setSession($session);
$accessToken->save();
if ($this->server->hasGrantType('refresh_token')) {
if (isset($refreshToken) && $this->server->hasGrantType('refresh_token')) {
$refreshToken->setAccessToken($accessToken);
$refreshToken->save();
}

View File

@ -37,7 +37,7 @@ class ClientCredentialsGrant extends AbstractGrant
/**
* AuthServer instance
* @var AuthServer
* @var \League\OAuth2\Server\AuthorizationServer
*/
protected $server = null;
@ -50,6 +50,7 @@ class ClientCredentialsGrant extends AbstractGrant
/**
* Complete the client credentials grant
* @return array
* @throws
*/
public function completeFlow()
{

View File

@ -61,6 +61,7 @@ class PasswordGrant extends AbstractGrant
/**
* Return the callback function
* @return callable
* @throws
*/
protected function getVerifyCredentialsCallback()
{
@ -74,6 +75,7 @@ class PasswordGrant extends AbstractGrant
/**
* Complete the password grant
* @return array
* @throws
*/
public function completeFlow()
{

View File

@ -16,7 +16,6 @@ use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Util\SecureKey;
/**

View File

@ -39,7 +39,7 @@ class ResourceServer extends AbstractServer
/**
* Initialise the resource server
* @param SessionInterface $sessionStorage
* @param AccessTokenInteface $accessTokenStorage
* @param AccessTokenInterface $accessTokenStorage
* @param ClientInterface $clientStorage
* @param ScopeInterface $scopeStorage
* @return self
@ -65,7 +65,7 @@ class ResourceServer extends AbstractServer
/**
* Sets the query string key for the access token.
* @param $key The new query string key
* @param string $key The new query string key
* @return self
*/
public function setIdKey($key)
@ -86,8 +86,12 @@ class ResourceServer extends AbstractServer
/**
* Checks if the access token is valid or not
* @param $headersOnly Limit Access Token to Authorization header only
* @param bool $headersOnly Limit Access Token to Authorization header only
* @param AccessTokenEntity|null $accessToken Access Token
*
* @return bool
*
* @throws
*/
public function isValidRequest($headersOnly = true, $accessToken = null)
{
@ -114,8 +118,8 @@ class ResourceServer extends AbstractServer
/**
* Reads in the access token from the headers
* @param $headersOnly Limit Access Token to Authorization header only
* @throws Exception\MissingAccessTokenException Thrown if there is no access token presented
* @param bool $headersOnly Limit Access Token to Authorization header only
* @throws Exception\InvalidRequestException Thrown if there is no access token presented
* @return string
*/
public function determineAccessToken($headersOnly = false)

View File

@ -27,6 +27,7 @@ abstract class AbstractStorage implements StorageInterface
/**
* Set the server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function setServer(AbstractServer $server)
{

View File

@ -39,7 +39,7 @@ interface AccessTokenInterface extends StorageInterface
* @param string $token The access token
* @param integer $expireTime The expire time expressed as a unix timestamp
* @param string|integer $sessionId The session ID
* @return \League\OAuth2\Server\Entity\AccessToken
* @return \League\OAuth2\Server\Entity\AccessTokenEntity
*/
public function create($token, $expireTime, $sessionId);

View File

@ -24,7 +24,7 @@ interface ClientInterface extends StorageInterface
* @param string $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used (default = "null")
* @return League\OAuth2\Server\Entity\ClientEntity
* @return \League\OAuth2\Server\Entity\ClientEntity
*/
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);

View File

@ -54,7 +54,7 @@ interface SessionInterface extends StorageInterface
/**
* Associate a scope with a session
* @param \League\OAuth2\Server\Entity\SessionEntity $scope The scope
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
* @return void
*/

View File

@ -38,6 +38,7 @@ abstract class AbstractTokenType
/**
* Set the server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function setServer(AbstractServer $server)
{
@ -49,6 +50,7 @@ abstract class AbstractTokenType
/**
* Set the session entity
* @param \League\OAuth2\Server\Entity\SessionEntity $session
* @return self
*/
public function setSession(SessionEntity $session)
{