mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
commit
2108c88dfb
@ -20,6 +20,6 @@ class Users
|
||||
return $result;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace RelationalExample\Storage;
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use League\OAuth2\Server\Entity\AbstractTokenEntity;
|
||||
use League\OAuth2\Server\Entity\AccessTokenEntity;
|
||||
use League\OAuth2\Server\Entity\ScopeEntity;
|
||||
use League\OAuth2\Server\Storage\AbstractStorage;
|
||||
@ -28,7 +27,7 @@ class AccessTokenStorage extends AbstractStorage implements AccessTokenInterface
|
||||
return $token;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ class AuthCodeStorage extends AbstractStorage implements AuthCodeInterface
|
||||
return $token;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
public function create($token, $expireTime, $sessionId, $redirectUri)
|
||||
|
@ -41,7 +41,7 @@ class ClientStorage extends AbstractStorage implements ClientInterface
|
||||
return $client;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,6 +65,6 @@ class ClientStorage extends AbstractStorage implements ClientInterface
|
||||
return $client;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class RefreshTokenStorage extends AbstractStorage implements RefreshTokenInterfa
|
||||
return $token;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ class ScopeStorage extends AbstractStorage implements ScopeInterface
|
||||
->get();
|
||||
|
||||
if (count($result) === 0) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return (new ScopeEntity($this->server))->hydrate([
|
||||
|
@ -31,7 +31,7 @@ class SessionStorage extends AbstractStorage implements SessionInterface
|
||||
return $session;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ class SessionStorage extends AbstractStorage implements SessionInterface
|
||||
return $session;
|
||||
}
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,48 +36,56 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Session storage
|
||||
*
|
||||
* @var \League\OAuth2\Server\Storage\SessionInterface
|
||||
*/
|
||||
protected $sessionStorage;
|
||||
|
||||
/**
|
||||
* Access token storage
|
||||
*
|
||||
* @var \League\OAuth2\Server\Storage\AccessTokenInterface
|
||||
*/
|
||||
protected $accessTokenStorage;
|
||||
|
||||
/**
|
||||
* Refresh token storage
|
||||
*
|
||||
* @var \League\OAuth2\Server\Storage\RefreshTokenInterface
|
||||
*/
|
||||
protected $refreshTokenStorage;
|
||||
|
||||
/**
|
||||
* Auth code storage
|
||||
*
|
||||
* @var \League\OAuth2\Server\Storage\AuthCodeInterface
|
||||
*/
|
||||
protected $authCodeStorage;
|
||||
|
||||
/**
|
||||
* Scope storage
|
||||
*
|
||||
* @var \League\OAuth2\Server\Storage\ScopeInterface
|
||||
*/
|
||||
protected $scopeStorage;
|
||||
|
||||
/**
|
||||
* Client storage
|
||||
*
|
||||
* @var \League\OAuth2\Server\Storage\ClientInterface
|
||||
*/
|
||||
protected $clientStorage;
|
||||
|
||||
/**
|
||||
* Token type
|
||||
*
|
||||
* @var \League\OAuth2\Server\TokenType\TokenTypeInterface
|
||||
*/
|
||||
protected $tokenType;
|
||||
|
||||
/**
|
||||
* Event emitter
|
||||
*
|
||||
* @var \League\Event\Emitter
|
||||
*/
|
||||
protected $eventEmitter;
|
||||
@ -92,6 +100,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set an event emitter
|
||||
*
|
||||
* @param object $emitter Event emitter object
|
||||
*/
|
||||
public function setEventEmitter($emitter = null)
|
||||
@ -105,6 +114,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Add an event listener to the event emitter
|
||||
*
|
||||
* @param string $eventName Event name
|
||||
* @param callable $listener Callable function or method
|
||||
*/
|
||||
@ -115,6 +125,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Returns the event emitter
|
||||
*
|
||||
* @return \League\Event\Emitter
|
||||
*/
|
||||
public function getEventEmitter()
|
||||
@ -124,7 +135,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Sets the Request Object
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request The Request Object
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setRequest($request)
|
||||
@ -136,6 +149,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Gets the Request object. It will create one from the globals if one is not set.
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
public function getRequest()
|
||||
@ -149,7 +163,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the client storage
|
||||
* @param \League\OAuth2\Server\Storage\ClientInterface $storage
|
||||
*
|
||||
* @param \League\OAuth2\Server\Storage\ClientInterface $storage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setClientStorage(ClientInterface $storage)
|
||||
@ -162,7 +178,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the session storage
|
||||
* @param \League\OAuth2\Server\Storage\SessionInterface $storage
|
||||
*
|
||||
* @param \League\OAuth2\Server\Storage\SessionInterface $storage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSessionStorage(SessionInterface $storage)
|
||||
@ -175,7 +193,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the access token storage
|
||||
* @param \League\OAuth2\Server\Storage\AccessTokenInterface $storage
|
||||
*
|
||||
* @param \League\OAuth2\Server\Storage\AccessTokenInterface $storage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAccessTokenStorage(AccessTokenInterface $storage)
|
||||
@ -188,7 +208,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the refresh token storage
|
||||
* @param \League\OAuth2\Server\Storage\RefreshTokenInterface $storage
|
||||
*
|
||||
* @param \League\OAuth2\Server\Storage\RefreshTokenInterface $storage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setRefreshTokenStorage(RefreshTokenInterface $storage)
|
||||
@ -201,7 +223,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the auth code storage
|
||||
* @param \League\OAuth2\Server\Storage\AuthCodeInterface $storage
|
||||
*
|
||||
* @param \League\OAuth2\Server\Storage\AuthCodeInterface $storage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAuthCodeStorage(AuthCodeInterface $storage)
|
||||
@ -214,7 +238,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the scope storage
|
||||
* @param \League\OAuth2\Server\Storage\ScopeInterface $storage
|
||||
*
|
||||
* @param \League\OAuth2\Server\Storage\ScopeInterface $storage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setScopeStorage(ScopeInterface $storage)
|
||||
@ -227,6 +253,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Return the client storage
|
||||
*
|
||||
* @return \League\OAuth2\Server\Storage\ClientInterface
|
||||
*/
|
||||
public function getClientStorage()
|
||||
@ -236,6 +263,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Return the scope storage
|
||||
*
|
||||
* @return \League\OAuth2\Server\Storage\ScopeInterface
|
||||
*/
|
||||
public function getScopeStorage()
|
||||
@ -245,6 +273,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Return the session storage
|
||||
*
|
||||
* @return \League\OAuth2\Server\Storage\SessionInterface
|
||||
*/
|
||||
public function getSessionStorage()
|
||||
@ -254,6 +283,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Return the refresh token storage
|
||||
*
|
||||
* @return \League\OAuth2\Server\Storage\RefreshTokenInterface
|
||||
*/
|
||||
public function getRefreshTokenStorage()
|
||||
@ -263,6 +293,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Return the access token storage
|
||||
*
|
||||
* @return \League\OAuth2\Server\Storage\AccessTokenInterface
|
||||
*/
|
||||
public function getAccessTokenStorage()
|
||||
@ -272,6 +303,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Return the auth code storage
|
||||
*
|
||||
* @return \League\OAuth2\Server\Storage\AuthCodeInterface
|
||||
*/
|
||||
public function getAuthCodeStorage()
|
||||
@ -281,7 +313,9 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Set the access token type
|
||||
* @param TokenTypeInterface $tokenType The token type
|
||||
*
|
||||
* @param TokenTypeInterface $tokenType The token type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTokenType(TokenTypeInterface $tokenType)
|
||||
@ -292,6 +326,7 @@ abstract class AbstractServer
|
||||
|
||||
/**
|
||||
* Get the access token type
|
||||
*
|
||||
* @return TokenTypeInterface
|
||||
*/
|
||||
public function getTokenType()
|
||||
|
@ -22,48 +22,56 @@ class AuthorizationServer extends AbstractServer
|
||||
/**
|
||||
* The delimeter between scopes specified in the scope query string parameter
|
||||
* The OAuth 2 specification states it should be a space but most use a comma
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $scopeDelimiter = ' ';
|
||||
|
||||
/**
|
||||
* The TTL (time to live) of an access token in seconds (default: 3600)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $accessTokenTTL = 3600;
|
||||
|
||||
/**
|
||||
* The registered grant response types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $responseTypes = [];
|
||||
|
||||
/**
|
||||
* The registered grant types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $grantTypes = [];
|
||||
|
||||
/**
|
||||
* Require the "scope" parameter to be in checkAuthoriseParams()
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $requireScopeParam = false;
|
||||
|
||||
/**
|
||||
* Default scope(s) to be used if none is provided
|
||||
*
|
||||
* @var string|array
|
||||
*/
|
||||
protected $defaultScope;
|
||||
|
||||
/**
|
||||
* Require the "state" parameter to be in checkAuthoriseParams()
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $requireStateParam = false;
|
||||
|
||||
/**
|
||||
* Create a new OAuth2 authorization server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function __construct()
|
||||
@ -78,8 +86,10 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Enable support for a grant
|
||||
* @param GrantTypeInterface $grantType A grant class which conforms to Interface/GrantTypeInterface
|
||||
* @param null|string $identifier An identifier for the grant (autodetected if not passed)
|
||||
*
|
||||
* @param GrantTypeInterface $grantType A grant class which conforms to Interface/GrantTypeInterface
|
||||
* @param null|string $identifier An identifier for the grant (autodetected if not passed)
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function addGrantType(GrantTypeInterface $grantType, $identifier = null)
|
||||
@ -102,7 +112,9 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Check if a grant type has been enabled
|
||||
* @param string $identifier The grant type identifier
|
||||
*
|
||||
* @param string $identifier The grant type identifier
|
||||
*
|
||||
* @return boolean Returns "true" if enabled, "false" if not
|
||||
*/
|
||||
public function hasGrantType($identifier)
|
||||
@ -112,6 +124,7 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Returns response types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getResponseTypes()
|
||||
@ -121,7 +134,9 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Require the "scope" parameter in checkAuthoriseParams()
|
||||
* @param boolean $require
|
||||
*
|
||||
* @param boolean $require
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function requireScopeParam($require = true)
|
||||
@ -133,6 +148,7 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Is the scope parameter required?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function scopeParamRequired()
|
||||
@ -142,7 +158,9 @@ 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
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDefaultScope($default = null)
|
||||
@ -154,6 +172,7 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Default scope to be used if none is provided and requireScopeParam is false
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDefaultScope()
|
||||
@ -163,6 +182,7 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Require the "state" paremter in checkAuthoriseParams()
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stateParamRequired()
|
||||
@ -172,7 +192,9 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Require the "state" paremter in checkAuthoriseParams()
|
||||
* @param boolean $require
|
||||
*
|
||||
* @param boolean $require
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function requireStateParam($require = true)
|
||||
@ -184,6 +206,7 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Get the scope delimiter
|
||||
*
|
||||
* @return string The scope delimiter (default: ",")
|
||||
*/
|
||||
public function getScopeDelimiter()
|
||||
@ -193,7 +216,9 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Set the scope delimiter
|
||||
*
|
||||
* @param string $scopeDelimiter
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setScopeDelimiter($scopeDelimiter = ' ')
|
||||
@ -205,6 +230,7 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Get the TTL for an access token
|
||||
*
|
||||
* @return int The TTL
|
||||
*/
|
||||
public function getAccessTokenTTL()
|
||||
@ -214,7 +240,9 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Set the TTL for an access token
|
||||
*
|
||||
* @param int $accessTokenTTL The new TTL
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAccessTokenTTL($accessTokenTTL = 3600)
|
||||
@ -226,7 +254,9 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Issue an access token
|
||||
*
|
||||
* @return array Authorise request parameters
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
public function issueAccessToken()
|
||||
@ -247,8 +277,11 @@ class AuthorizationServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Return a grant type class
|
||||
* @param string $grantType The grant type identifier
|
||||
*
|
||||
* @param string $grantType The grant type identifier
|
||||
*
|
||||
* @return Grant\GrantTypeInterface
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
public function getGrantType($grantType)
|
||||
|
@ -21,37 +21,44 @@ abstract class AbstractTokenEntity
|
||||
{
|
||||
/**
|
||||
* Token identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Associated session
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* Session scopes
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\ScopeEntity[]
|
||||
*/
|
||||
protected $scopes;
|
||||
|
||||
/**
|
||||
* Token expire time
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $expireTime = 0;
|
||||
|
||||
/**
|
||||
* Authorization or resource server
|
||||
*
|
||||
* @var \League\OAuth2\Server\AbstractServer
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function __construct(AbstractServer $server)
|
||||
@ -63,7 +70,9 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Set session
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSession(SessionEntity $session)
|
||||
@ -75,7 +84,9 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Set the expire time of the token
|
||||
* @param integer $expireTime Unix time stamp
|
||||
*
|
||||
* @param integer $expireTime Unix time stamp
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setExpireTime($expireTime)
|
||||
@ -87,6 +98,7 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Return token expire time
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getExpireTime()
|
||||
@ -96,6 +108,7 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Is the token expired?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isExpired()
|
||||
@ -105,7 +118,9 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Set token ID
|
||||
* @param string $id Token ID
|
||||
*
|
||||
* @param string $id Token ID
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id = null)
|
||||
@ -117,6 +132,7 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Get the token ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
@ -126,7 +142,9 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Associate a scope
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function associateScope(ScopeEntity $scope)
|
||||
@ -140,7 +158,9 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Format the local scopes array
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity[]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function formatScopes($unformatted = [])
|
||||
@ -161,6 +181,7 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Returns the token as a string if the object is cast as a string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
@ -174,12 +195,14 @@ abstract class AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Expire the token
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function expire();
|
||||
|
||||
/**
|
||||
* Save the token
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function save();
|
||||
|
@ -18,6 +18,7 @@ class AccessTokenEntity extends AbstractTokenEntity
|
||||
{
|
||||
/**
|
||||
* Get session
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
public function getSession()
|
||||
@ -33,7 +34,9 @@ class AccessTokenEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Check if access token has an associated scope
|
||||
* @param string $scope Scope to check
|
||||
*
|
||||
* @param string $scope Scope to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasScope($scope)
|
||||
@ -47,6 +50,7 @@ class AccessTokenEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Return all scopes associated with the access token
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
|
||||
*/
|
||||
public function getScopes()
|
||||
|
@ -18,13 +18,16 @@ class AuthCodeEntity extends AbstractTokenEntity
|
||||
{
|
||||
/**
|
||||
* Redirect URI
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectUri = '';
|
||||
|
||||
/**
|
||||
* Set the redirect URI for the authorization request
|
||||
* @param string $redirectUri
|
||||
*
|
||||
* @param string $redirectUri
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setRedirectUri($redirectUri)
|
||||
@ -36,6 +39,7 @@ class AuthCodeEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Get the redirect URI
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRedirectUri()
|
||||
@ -45,8 +49,10 @@ class AuthCodeEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Generate a redirect URI
|
||||
* @param string $state The state parameter if set by the client
|
||||
* @param string $queryDelimeter The query delimiter ('?' for auth code grant, '#' for implicit grant)
|
||||
*
|
||||
* @param string $state The state parameter if set by the client
|
||||
* @param string $queryDelimeter The query delimiter ('?' for auth code grant, '#' for implicit grant)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateRedirectUri($state = null, $queryDelimeter = '?')
|
||||
@ -62,6 +68,7 @@ class AuthCodeEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Get session
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
public function getSession()
|
||||
@ -77,6 +84,7 @@ class AuthCodeEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Return all scopes associated with the session
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
|
||||
*/
|
||||
public function getScopes()
|
||||
|
@ -22,37 +22,44 @@ class ClientEntity
|
||||
|
||||
/**
|
||||
* Client identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id = null;
|
||||
|
||||
/**
|
||||
* Client secret
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $secret = null;
|
||||
|
||||
/**
|
||||
* Client name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = null;
|
||||
|
||||
/**
|
||||
* Client redirect URI
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectUri = null;
|
||||
|
||||
/**
|
||||
* Authorization or resource server
|
||||
*
|
||||
* @var \League\OAuth2\Server\AbstractServer
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function __construct(AbstractServer $server)
|
||||
@ -64,6 +71,7 @@ class ClientEntity
|
||||
|
||||
/**
|
||||
* Return the client identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
@ -73,6 +81,7 @@ class ClientEntity
|
||||
|
||||
/**
|
||||
* Return the client secret
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSecret()
|
||||
@ -82,6 +91,7 @@ class ClientEntity
|
||||
|
||||
/**
|
||||
* Get the client name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
@ -91,6 +101,7 @@ class ClientEntity
|
||||
|
||||
/**
|
||||
* Returnt the client redirect URI
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRedirectUri()
|
||||
|
@ -15,7 +15,9 @@ trait EntityTrait
|
||||
{
|
||||
/**
|
||||
* Hydrate an entity with properites
|
||||
*
|
||||
* @param array $properties
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function hydrate(array $properties)
|
||||
|
@ -18,19 +18,23 @@ class RefreshTokenEntity extends AbstractTokenEntity
|
||||
{
|
||||
/**
|
||||
* Access token associated to refresh token
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\AccessTokenEntity
|
||||
*/
|
||||
protected $accessTokenEntity;
|
||||
|
||||
/**
|
||||
* Id of the access token
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $accessTokenId;
|
||||
|
||||
/**
|
||||
* Set the ID of the associated access token
|
||||
* @param string $accessTokenId
|
||||
*
|
||||
* @param string $accessTokenId
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAccessTokenId($accessTokenId)
|
||||
@ -42,7 +46,9 @@ class RefreshTokenEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Associate an access token
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessTokenEntity
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessTokenEntity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAccessToken(AccessTokenEntity $accessTokenEntity)
|
||||
@ -54,6 +60,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
|
||||
|
||||
/**
|
||||
* Return access token
|
||||
*
|
||||
* @return AccessTokenEntity
|
||||
*/
|
||||
public function getAccessToken()
|
||||
|
@ -22,25 +22,30 @@ class ScopeEntity implements \JsonSerializable
|
||||
|
||||
/**
|
||||
* Scope identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Scope description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Authorization or resource server
|
||||
*
|
||||
* @var \League\OAuth2\Server\AbstractServer
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function __construct(AbstractServer $server)
|
||||
@ -52,6 +57,7 @@ class ScopeEntity implements \JsonSerializable
|
||||
|
||||
/**
|
||||
* Return the scope identifer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
@ -61,6 +67,7 @@ class ScopeEntity implements \JsonSerializable
|
||||
|
||||
/**
|
||||
* Return the scope's description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
@ -70,6 +77,7 @@ class ScopeEntity implements \JsonSerializable
|
||||
|
||||
/**
|
||||
* Returns a JSON object when entity is passed into json_encode
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
|
@ -21,61 +21,72 @@ class SessionEntity
|
||||
{
|
||||
/**
|
||||
* Session identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Client identifier
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\ClientEntity
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Session owner identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $ownerId;
|
||||
|
||||
/**
|
||||
* Session owner type (e.g. "user")
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $ownerType;
|
||||
|
||||
/**
|
||||
* Auth code
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\AuthCodeEntity
|
||||
*/
|
||||
protected $authCode;
|
||||
|
||||
/**
|
||||
* Access token
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\AccessTokenEntity
|
||||
*/
|
||||
protected $accessToken;
|
||||
|
||||
/**
|
||||
* Refresh token
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\RefreshTokenEntity
|
||||
*/
|
||||
protected $refreshToken;
|
||||
|
||||
/**
|
||||
* Session scopes
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
||||
*/
|
||||
protected $scopes;
|
||||
|
||||
/**
|
||||
* Authorization or resource server
|
||||
*
|
||||
* @var \League\OAuth2\Server\AuthorizationServer|\League\OAuth2\Server\ResourceServer
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function __construct(AbstractServer $server)
|
||||
@ -87,7 +98,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Set the session identifier
|
||||
* @param string $id
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setId($id)
|
||||
@ -99,6 +112,7 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Return the session identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
@ -108,7 +122,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Associate a scope
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function associateScope(ScopeEntity $scope)
|
||||
@ -122,7 +138,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Check if access token has an associated scope
|
||||
* @param string $scope Scope to check
|
||||
*
|
||||
* @param string $scope Scope to check
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasScope($scope)
|
||||
@ -136,6 +154,7 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Return all scopes associated with the session
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\ScopeEntity[]
|
||||
*/
|
||||
public function getScopes()
|
||||
@ -149,7 +168,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Format the local scopes array
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\Scope[]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function formatScopes($unformatted = [])
|
||||
@ -168,7 +189,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Associate an access token with the session
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function associateAccessToken(AccessTokenEntity $accessToken)
|
||||
@ -180,7 +203,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Associate a refresh token with the session
|
||||
* @param \League\OAuth2\Server\Entity\RefreshTokenEntity $refreshToken
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\RefreshTokenEntity $refreshToken
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function associateRefreshToken(RefreshTokenEntity $refreshToken)
|
||||
@ -192,7 +217,9 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Associate a client with the session
|
||||
* @param \League\OAuth2\Server\Entity\ClientEntity $client The client
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\ClientEntity $client The client
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function associateClient(ClientEntity $client)
|
||||
@ -204,6 +231,7 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Return the session client
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\ClientEntity
|
||||
*/
|
||||
public function getClient()
|
||||
@ -219,8 +247,10 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Set the session owner
|
||||
* @param string $type The type of the owner (e.g. user, app)
|
||||
* @param string $id The identifier of the owner
|
||||
*
|
||||
* @param string $type The type of the owner (e.g. user, app)
|
||||
* @param string $id The identifier of the owner
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setOwner($type, $id)
|
||||
@ -235,6 +265,7 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Return session owner identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOwnerId()
|
||||
@ -244,6 +275,7 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Return session owner type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOwnerType()
|
||||
@ -253,6 +285,7 @@ class SessionEntity
|
||||
|
||||
/**
|
||||
* Save the session
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save()
|
||||
|
@ -18,12 +18,14 @@ class ClientAuthenticationFailedEvent extends AbstractEvent
|
||||
{
|
||||
/**
|
||||
* Request
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* Init the event with a request
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
@ -33,6 +35,7 @@ class ClientAuthenticationFailedEvent extends AbstractEvent
|
||||
|
||||
/**
|
||||
* The name of the event
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
@ -42,6 +45,7 @@ class ClientAuthenticationFailedEvent extends AbstractEvent
|
||||
|
||||
/**
|
||||
* Return request
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
public function getRequest()
|
||||
|
@ -18,12 +18,14 @@ class SessionOwnerEvent extends AbstractEvent
|
||||
{
|
||||
/**
|
||||
* Session entity
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
private $session;
|
||||
|
||||
/**
|
||||
* Init the event with a session
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session
|
||||
*/
|
||||
public function __construct(SessionEntity $session)
|
||||
@ -33,6 +35,7 @@ class SessionOwnerEvent extends AbstractEvent
|
||||
|
||||
/**
|
||||
* The name of the event
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
@ -42,6 +45,7 @@ class SessionOwnerEvent extends AbstractEvent
|
||||
|
||||
/**
|
||||
* Return session
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
public function getSession()
|
||||
|
@ -18,12 +18,14 @@ class UserAuthenticationFailedEvent extends AbstractEvent
|
||||
{
|
||||
/**
|
||||
* Request
|
||||
*
|
||||
* @var \Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* Init the event with a request
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
@ -33,6 +35,7 @@ class UserAuthenticationFailedEvent extends AbstractEvent
|
||||
|
||||
/**
|
||||
* The name of the event
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
@ -42,6 +45,7 @@ class UserAuthenticationFailedEvent extends AbstractEvent
|
||||
|
||||
/**
|
||||
* Return request
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
public function getRequest()
|
||||
|
@ -26,6 +26,7 @@ class OAuthException extends \Exception
|
||||
|
||||
/**
|
||||
* Redirect URI if the server should redirect back to the client
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $redirectUri = null;
|
||||
@ -37,6 +38,7 @@ class OAuthException extends \Exception
|
||||
|
||||
/**
|
||||
* Throw a new exception
|
||||
*
|
||||
* @param string $msg Exception Message
|
||||
*/
|
||||
public function __construct($msg = 'An error occured')
|
||||
@ -46,6 +48,7 @@ class OAuthException extends \Exception
|
||||
|
||||
/**
|
||||
* Should the server redirect back to the client?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldRedirect()
|
||||
@ -55,6 +58,7 @@ class OAuthException extends \Exception
|
||||
|
||||
/**
|
||||
* Return redirect URI if set
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRedirectUri()
|
||||
@ -70,6 +74,7 @@ class OAuthException extends \Exception
|
||||
|
||||
/**
|
||||
* Get all headers that have to be send with the error response
|
||||
*
|
||||
* @return array Array with header values
|
||||
*/
|
||||
public function getHttpHeaders()
|
||||
|
@ -23,30 +23,35 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = '';
|
||||
|
||||
/**
|
||||
* Response type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $responseType;
|
||||
|
||||
/**
|
||||
* Callback to authenticate a user's name and password
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
protected $callback;
|
||||
|
||||
/**
|
||||
* AuthServer instance
|
||||
*
|
||||
* @var \League\OAuth2\Server\AuthorizationServer
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Access token expires in override
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $accessTokenTTL;
|
||||
@ -79,6 +84,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
|
||||
/**
|
||||
* Get the TTL for an access token
|
||||
*
|
||||
* @return int The TTL
|
||||
*/
|
||||
public function getAccessTokenTTL()
|
||||
@ -92,7 +98,9 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
|
||||
/**
|
||||
* Override the default access token expire time
|
||||
* @param int $accessTokenTTL
|
||||
*
|
||||
* @param int $accessTokenTTL
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAccessTokenTTL($accessTokenTTL)
|
||||
@ -114,10 +122,13 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
|
||||
/**
|
||||
* Given a list of scopes, validate them and return an array of Scope entities
|
||||
* @param string $scopeParam A string of scopes (e.g. "profile email birthday")
|
||||
* @param \League\OAuth2\Server\Entity\ClientEntity $client Client entity
|
||||
* @param string|null $redirectUri The redirect URI to return the user to
|
||||
*
|
||||
* @param string $scopeParam A string of scopes (e.g. "profile email birthday")
|
||||
* @param \League\OAuth2\Server\Entity\ClientEntity $client Client entity
|
||||
* @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
|
||||
*/
|
||||
@ -167,7 +178,9 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
|
||||
/**
|
||||
* Format the local scopes array
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity[]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function formatScopes($unformated = [])
|
||||
|
@ -27,37 +27,44 @@ class AuthCodeGrant extends AbstractGrant
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = 'authorization_code';
|
||||
|
||||
/**
|
||||
* Response type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $responseType = 'code';
|
||||
|
||||
/**
|
||||
* AuthServer instance
|
||||
*
|
||||
* @var \League\OAuth2\Server\AuthorizationServer
|
||||
*/
|
||||
protected $server = null;
|
||||
|
||||
/**
|
||||
* Access token expires in override
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $accessTokenTTL = null;
|
||||
|
||||
/**
|
||||
* The TTL of the auth token
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $authTokenTTL = 600;
|
||||
|
||||
/**
|
||||
* Override the default access token expire time
|
||||
* @param int $authTokenTTL
|
||||
*
|
||||
* @param int $authTokenTTL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAuthTokenTTL($authTokenTTL)
|
||||
@ -129,9 +136,10 @@ class AuthCodeGrant extends AbstractGrant
|
||||
/**
|
||||
* Parse a new authorize request
|
||||
*
|
||||
* @param string $type The session owner's type
|
||||
* @param string $typeId The session owner's ID
|
||||
* @param array $authParams The authorize request $_GET parameters
|
||||
* @param string $type The session owner's type
|
||||
* @param string $typeId The session owner's ID
|
||||
* @param array $authParams The authorize request $_GET parameters
|
||||
*
|
||||
* @return string An authorisation code
|
||||
*/
|
||||
public function newAuthorizeRequest($type, $typeId, $authParams = [])
|
||||
@ -160,7 +168,9 @@ class AuthCodeGrant extends AbstractGrant
|
||||
|
||||
/**
|
||||
* Complete the auth code grant
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
public function completeFlow()
|
||||
|
@ -25,31 +25,37 @@ class ClientCredentialsGrant extends AbstractGrant
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = 'client_credentials';
|
||||
|
||||
/**
|
||||
* Response type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $responseType = null;
|
||||
|
||||
/**
|
||||
* AuthServer instance
|
||||
*
|
||||
* @var \League\OAuth2\Server\AuthorizationServer
|
||||
*/
|
||||
protected $server = null;
|
||||
|
||||
/**
|
||||
* Access token expires in override
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $accessTokenTTL = null;
|
||||
|
||||
/**
|
||||
* Complete the client credentials grant
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
public function completeFlow()
|
||||
|
@ -20,32 +20,39 @@ interface GrantTypeInterface
|
||||
{
|
||||
/**
|
||||
* Return the identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifier();
|
||||
|
||||
/**
|
||||
* Return the identifier
|
||||
* @param string $identifier
|
||||
*
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setIdentifier($identifier);
|
||||
|
||||
/**
|
||||
* Return the response type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseType();
|
||||
|
||||
/**
|
||||
* Inject the authorization server into the grant
|
||||
* @param \League\OAuth2\Server\AuthorizationServer $server The authorization server instance
|
||||
*
|
||||
* @param \League\OAuth2\Server\AuthorizationServer $server The authorization server instance
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAuthorizationServer(AuthorizationServer $server);
|
||||
|
||||
/**
|
||||
* Complete the grant flow
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function completeFlow();
|
||||
|
@ -26,31 +26,37 @@ class PasswordGrant extends AbstractGrant
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = 'password';
|
||||
|
||||
/**
|
||||
* Response type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $responseType;
|
||||
|
||||
/**
|
||||
* Callback to authenticate a user's name and password
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
protected $callback;
|
||||
|
||||
/**
|
||||
* Access token expires in override
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $accessTokenTTL;
|
||||
|
||||
/**
|
||||
* Set the callback to verify a user's username and password
|
||||
* @param callable $callback The callback function
|
||||
*
|
||||
* @param callable $callback The callback function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVerifyCredentialsCallback(callable $callback)
|
||||
@ -60,7 +66,9 @@ class PasswordGrant extends AbstractGrant
|
||||
|
||||
/**
|
||||
* Return the callback function
|
||||
*
|
||||
* @return callable
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
protected function getVerifyCredentialsCallback()
|
||||
@ -74,7 +82,9 @@ class PasswordGrant extends AbstractGrant
|
||||
|
||||
/**
|
||||
* Complete the password grant
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
public function completeFlow()
|
||||
|
@ -30,13 +30,16 @@ class RefreshTokenGrant extends AbstractGrant
|
||||
|
||||
/**
|
||||
* Refresh token TTL (default = 604800 | 1 week)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $refreshTokenTTL = 604800;
|
||||
|
||||
/**
|
||||
* Set the TTL of the refresh token
|
||||
* @param int $refreshTokenTTL
|
||||
*
|
||||
* @param int $refreshTokenTTL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRefreshTokenTTL($refreshTokenTTL)
|
||||
@ -46,6 +49,7 @@ class RefreshTokenGrant extends AbstractGrant
|
||||
|
||||
/**
|
||||
* Get the TTL of the refresh token
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRefreshTokenTTL()
|
||||
|
@ -25,22 +25,26 @@ class ResourceServer extends AbstractServer
|
||||
{
|
||||
/**
|
||||
* The access token
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\AccessTokenEntity
|
||||
*/
|
||||
protected $accessToken;
|
||||
|
||||
/**
|
||||
* The query string key which is used by clients to present the access token (default: access_token)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $tokenKey = 'access_token';
|
||||
|
||||
/**
|
||||
* Initialise the resource server
|
||||
* @param SessionInterface $sessionStorage
|
||||
* @param AccessTokenInterface $accessTokenStorage
|
||||
* @param ClientInterface $clientStorage
|
||||
* @param ScopeInterface $scopeStorage
|
||||
*
|
||||
* @param SessionInterface $sessionStorage
|
||||
* @param AccessTokenInterface $accessTokenStorage
|
||||
* @param ClientInterface $clientStorage
|
||||
* @param ScopeInterface $scopeStorage
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function __construct(
|
||||
@ -64,7 +68,9 @@ class ResourceServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Sets the query string key for the access token.
|
||||
*
|
||||
* @param string $key The new query string key
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setIdKey($key)
|
||||
@ -76,6 +82,7 @@ class ResourceServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Gets the access token
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\AccessTokenEntity
|
||||
*/
|
||||
public function getAccessToken()
|
||||
@ -85,7 +92,8 @@ class ResourceServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Checks if the access token is valid or not
|
||||
* @param bool $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
|
||||
@ -117,8 +125,11 @@ class ResourceServer extends AbstractServer
|
||||
|
||||
/**
|
||||
* Reads in the access token from the headers
|
||||
*
|
||||
* @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)
|
||||
|
@ -20,13 +20,16 @@ abstract class AbstractStorage implements StorageInterface
|
||||
{
|
||||
/**
|
||||
* Server
|
||||
*
|
||||
* @var \League\OAuth2\Server\AbstractServer $server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Set the server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setServer(AbstractServer $server)
|
||||
@ -38,6 +41,7 @@ abstract class AbstractStorage implements StorageInterface
|
||||
|
||||
/**
|
||||
* Return the server
|
||||
*
|
||||
* @return \League\OAuth2\Server\AbstractServer
|
||||
*/
|
||||
protected function getServer()
|
||||
|
@ -21,38 +21,48 @@ interface AccessTokenInterface extends StorageInterface
|
||||
{
|
||||
/**
|
||||
* Get an instance of Entity\AccessTokenEntity
|
||||
* @param string $token The access token
|
||||
*
|
||||
* @param string $token The access token
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\AccessTokenEntity
|
||||
*/
|
||||
public function get($token);
|
||||
|
||||
/**
|
||||
* Get the scopes for an access token
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
|
||||
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
|
||||
*
|
||||
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
|
||||
*/
|
||||
public function getScopes(AccessTokenEntity $token);
|
||||
|
||||
/**
|
||||
* Creates a new access token
|
||||
* @param string $token The access token
|
||||
* @param integer $expireTime The expire time expressed as a unix timestamp
|
||||
* @param string|integer $sessionId The session ID
|
||||
*
|
||||
* @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 void
|
||||
*/
|
||||
public function create($token, $expireTime, $sessionId);
|
||||
|
||||
/**
|
||||
* Associate a scope with an acess token
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function associateScope(AccessTokenEntity $token, ScopeEntity $scope);
|
||||
|
||||
/**
|
||||
* Delete an access token
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token to delete
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token to delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete(AccessTokenEntity $token);
|
||||
|
@ -21,39 +21,49 @@ interface AuthCodeInterface extends StorageInterface
|
||||
{
|
||||
/**
|
||||
* Get the auth code
|
||||
* @param string $code
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\AuthCodeEntity
|
||||
*/
|
||||
public function get($code);
|
||||
|
||||
/**
|
||||
* Create an auth code.
|
||||
*
|
||||
* @param string $token The token ID
|
||||
* @param integer $expireTime Token expire time
|
||||
* @param integer $sessionId Session identifier
|
||||
* @param string $redirectUri Client redirect uri
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function create($token, $expireTime, $sessionId, $redirectUri);
|
||||
|
||||
/**
|
||||
* Get the scopes for an access token
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code
|
||||
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code
|
||||
*
|
||||
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
|
||||
*/
|
||||
public function getScopes(AuthCodeEntity $token);
|
||||
|
||||
/**
|
||||
* Associate a scope with an acess token
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function associateScope(AuthCodeEntity $token, ScopeEntity $scope);
|
||||
|
||||
/**
|
||||
* Delete an access token
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The access token to delete
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The access token to delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete(AuthCodeEntity $token);
|
||||
|
@ -20,17 +20,21 @@ interface ClientInterface extends StorageInterface
|
||||
{
|
||||
/**
|
||||
* Validate a client
|
||||
* @param string $clientId The client's ID
|
||||
* @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")
|
||||
*
|
||||
* @param string $clientId The client's ID
|
||||
* @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
|
||||
*/
|
||||
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);
|
||||
|
||||
/**
|
||||
* Get the client associated with a session
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\ClientEntity
|
||||
*/
|
||||
public function getBySession(SessionEntity $session);
|
||||
|
@ -20,23 +20,29 @@ interface RefreshTokenInterface extends StorageInterface
|
||||
{
|
||||
/**
|
||||
* Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity
|
||||
* @param string $token
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\RefreshTokenEntity
|
||||
*/
|
||||
public function get($token);
|
||||
|
||||
/**
|
||||
* Create a new refresh token_name
|
||||
* @param string $token
|
||||
* @param integer $expireTime
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @param string $token
|
||||
* @param integer $expireTime
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\RefreshTokenEntity
|
||||
*/
|
||||
public function create($token, $expireTime, $accessToken);
|
||||
|
||||
/**
|
||||
* Delete the refresh token
|
||||
* @param \League\OAuth2\Server\Entity\RefreshTokenEntity $token
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\RefreshTokenEntity $token
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete(RefreshTokenEntity $token);
|
||||
|
@ -18,9 +18,11 @@ interface ScopeInterface extends StorageInterface
|
||||
{
|
||||
/**
|
||||
* Return information about a scope
|
||||
* @param string $scope The scope
|
||||
* @param string $grantType The grant type used in the request (default = "null")
|
||||
* @param string $clientId The client sending the request (default = "null")
|
||||
*
|
||||
* @param string $scope The scope
|
||||
* @param string $grantType The grant type used in the request (default = "null")
|
||||
* @param string $clientId The client sending the request (default = "null")
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\ScopeEntity
|
||||
*/
|
||||
public function get($scope, $grantType = null, $clientId = null);
|
||||
|
@ -23,39 +23,49 @@ interface SessionInterface extends StorageInterface
|
||||
{
|
||||
/**
|
||||
* Get a session from an access token
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
public function getByAccessToken(AccessTokenEntity $accessToken);
|
||||
|
||||
/**
|
||||
* Get a session from an auth code
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $authCode The auth code
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $authCode The auth code
|
||||
*
|
||||
* @return \League\OAuth2\Server\Entity\SessionEntity
|
||||
*/
|
||||
public function getByAuthCode(AuthCodeEntity $authCode);
|
||||
|
||||
/**
|
||||
* Get a session's scopes
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity
|
||||
*
|
||||
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
|
||||
*/
|
||||
public function getScopes(SessionEntity $session);
|
||||
|
||||
/**
|
||||
* Create a new session
|
||||
* @param string $ownerType Session owner's type (user, client)
|
||||
* @param string $ownerId Session owner's ID
|
||||
* @param string $clientId Client ID
|
||||
* @param string $clientRedirectUri Client redirect URI (default = null)
|
||||
*
|
||||
* @param string $ownerType Session owner's type (user, client)
|
||||
* @param string $ownerId Session owner's ID
|
||||
* @param string $clientId Client ID
|
||||
* @param string $clientRedirectUri Client redirect URI (default = null)
|
||||
*
|
||||
* @return integer The session's ID
|
||||
*/
|
||||
public function create($ownerType, $ownerId, $clientId, $clientRedirectUri = null);
|
||||
|
||||
/**
|
||||
* Associate a scope with a session
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
||||
*
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
|
||||
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function associateScope(SessionEntity $session, ScopeEntity $scope);
|
||||
|
@ -20,6 +20,7 @@ interface StorageInterface
|
||||
{
|
||||
/**
|
||||
* Set the server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*/
|
||||
public function setServer(AbstractServer $server);
|
||||
|
@ -18,18 +18,21 @@ abstract class AbstractTokenType
|
||||
{
|
||||
/**
|
||||
* Response array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $response = [];
|
||||
|
||||
/**
|
||||
* Server
|
||||
*
|
||||
* @var \League\OAuth2\Server\AbstractServer $server
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Server
|
||||
*
|
||||
* @var \League\OAuth2\Server\Entity\SessionEntity $session
|
||||
*/
|
||||
protected $session;
|
||||
|
@ -19,19 +19,23 @@ interface TokenTypeInterface
|
||||
{
|
||||
/**
|
||||
* Generate a response
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function generateResponse();
|
||||
|
||||
/**
|
||||
* Set the server
|
||||
*
|
||||
* @param \League\OAuth2\Server\AbstractServer $server
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setServer(AbstractServer $server);
|
||||
|
||||
/**
|
||||
* Set a key/value response pair
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
@ -39,20 +43,25 @@ interface TokenTypeInterface
|
||||
|
||||
/**
|
||||
* Get a key from the response array
|
||||
* @param string $key
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getParam($key);
|
||||
|
||||
/**
|
||||
* @param \League\OAuth2\Server\Entity\SessionEntity $session
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSession(SessionEntity $session);
|
||||
|
||||
/**
|
||||
* Determine the access token in the authorization header
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function determineAccessTokenInHeader(Request $request);
|
||||
|
@ -21,7 +21,7 @@ class DefaultAlgorithm implements KeyAlgorithmInterface
|
||||
$stripped = '';
|
||||
do {
|
||||
$bytes = openssl_random_pseudo_bytes($len, $strong);
|
||||
|
||||
|
||||
// We want to stop execution if the key fails because, well, that is bad.
|
||||
if ($bytes === false || $strong === false) {
|
||||
// @codeCoverageIgnoreStart
|
||||
@ -30,6 +30,7 @@ class DefaultAlgorithm implements KeyAlgorithmInterface
|
||||
}
|
||||
$stripped .= str_replace(['/', '+', '='], '', base64_encode($bytes));
|
||||
} while (strlen($stripped) < $len);
|
||||
|
||||
return substr($stripped, 0, $len);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ interface KeyAlgorithmInterface
|
||||
{
|
||||
/**
|
||||
* Generate a new unique code
|
||||
* @param integer $len Length of the generated code
|
||||
*
|
||||
* @param integer $len Length of the generated code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generate($len);
|
||||
|
@ -18,9 +18,11 @@ class RedirectUri
|
||||
{
|
||||
/**
|
||||
* Generate a new redirect uri
|
||||
* @param string $uri The base URI
|
||||
* @param array $params The query string parameters
|
||||
* @param string $queryDelimeter The query string delimeter (default: "?")
|
||||
*
|
||||
* @param string $uri The base URI
|
||||
* @param array $params The query string parameters
|
||||
* @param string $queryDelimeter The query string delimeter (default: "?")
|
||||
*
|
||||
* @return string The updated URI
|
||||
*/
|
||||
public static function make($uri, $params = [], $queryDelimeter = '?')
|
||||
|
@ -23,7 +23,9 @@ class SecureKey
|
||||
|
||||
/**
|
||||
* Generate a new unique code
|
||||
* @param integer $len Length of the generated code
|
||||
*
|
||||
* @param integer $len Length of the generated code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function generate($len = 40)
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace LeagueTests\Entity;
|
||||
|
||||
use LeagueTests\Stubs\StubAbstractTokenEntity;
|
||||
use League\OAuth2\Server\AuthorizationServer;
|
||||
use League\OAuth2\Server\Entity\ScopeEntity;
|
||||
use League\OAuth2\Server\Entity\SessionEntity;
|
||||
use LeagueTests\Stubs\StubAbstractTokenEntity;
|
||||
use Mockery as M;
|
||||
|
||||
class AbstractTokenEntityTest extends \PHPUnit_Framework_TestCase
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace LeagueTests\Grant;
|
||||
|
||||
use LeagueTests\Stubs\StubAbstractGrant;
|
||||
use League\OAuth2\Server\AuthorizationServer;
|
||||
use League\OAuth2\Server\Entity\ClientEntity;
|
||||
use League\OAuth2\Server\Entity\ScopeEntity;
|
||||
use League\OAuth2\Server\Exception\InvalidRequestException;
|
||||
use League\OAuth2\Server\Grant;
|
||||
use LeagueTests\Stubs\StubAbstractGrant;
|
||||
use Mockery as M;
|
||||
|
||||
class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
|
@ -288,7 +288,7 @@ class RefreshTokenGrantTest extends \PHPUnit_Framework_TestCase
|
||||
public function testCompleteFlowExpiredRefreshToken()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRefreshException');
|
||||
|
||||
|
||||
$_POST = [
|
||||
'grant_type' => 'refresh_token',
|
||||
'client_id' => 'testapp',
|
||||
|
Loading…
Reference in New Issue
Block a user