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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,6 +36,7 @@ class OAuthException extends \Exception
/** /**
* Throw a new exception * Throw a new exception
* @param string $msg Exception Message
*/ */
public function __construct($msg = 'An error occured') 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 * @param string|null $redirectUri The redirect URI to return the user to
* @return \League\OAuth2\Server\Entity\ScopeEntity[] * @return \League\OAuth2\Server\Entity\ScopeEntity[]
* @throws \League\OAuth2\Server\Exception\InvalidScopeException If scope is invalid, or no scopes passed when required * @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) 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\Entity\SessionEntity;
use League\OAuth2\Server\Event; use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception; use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Util\SecureKey; use League\OAuth2\Server\Util\SecureKey;
/** /**
@ -40,7 +39,7 @@ class AuthCodeGrant extends AbstractGrant
/** /**
* AuthServer instance * AuthServer instance
* @var AuthServer * @var \League\OAuth2\Server\AuthorizationServer
*/ */
protected $server = null; protected $server = null;
@ -70,6 +69,8 @@ class AuthCodeGrant extends AbstractGrant
* Check authorize parameters * Check authorize parameters
* *
* @return array Authorize request parameters * @return array Authorize request parameters
*
* @throws
*/ */
public function checkAuthorizeParams() public function checkAuthorizeParams()
{ {
@ -160,6 +161,7 @@ class AuthCodeGrant extends AbstractGrant
/** /**
* Complete the auth code grant * Complete the auth code grant
* @return array * @return array
* @throws
*/ */
public function completeFlow() public function completeFlow()
{ {
@ -257,7 +259,7 @@ class AuthCodeGrant extends AbstractGrant
$accessToken->setSession($session); $accessToken->setSession($session);
$accessToken->save(); $accessToken->save();
if ($this->server->hasGrantType('refresh_token')) { if (isset($refreshToken) && $this->server->hasGrantType('refresh_token')) {
$refreshToken->setAccessToken($accessToken); $refreshToken->setAccessToken($accessToken);
$refreshToken->save(); $refreshToken->save();
} }

View File

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

View File

@ -61,6 +61,7 @@ class PasswordGrant extends AbstractGrant
/** /**
* Return the callback function * Return the callback function
* @return callable * @return callable
* @throws
*/ */
protected function getVerifyCredentialsCallback() protected function getVerifyCredentialsCallback()
{ {
@ -74,6 +75,7 @@ class PasswordGrant extends AbstractGrant
/** /**
* Complete the password grant * Complete the password grant
* @return array * @return array
* @throws
*/ */
public function completeFlow() 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\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Event; use League\OAuth2\Server\Event;
use League\OAuth2\Server\Exception; use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Request;
use League\OAuth2\Server\Util\SecureKey; use League\OAuth2\Server\Util\SecureKey;
/** /**

View File

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

View File

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

View File

@ -39,7 +39,7 @@ interface AccessTokenInterface extends StorageInterface
* @param string $token The access token * @param string $token The access token
* @param integer $expireTime The expire time expressed as a unix timestamp * @param integer $expireTime The expire time expressed as a unix timestamp
* @param string|integer $sessionId The session ID * @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); 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 $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null") * @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used (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); 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 * 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 * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
* @return void * @return void
*/ */

View File

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