mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	CS fixer changes
This commit is contained in:
		| @@ -11,7 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server; | ||||
|  | ||||
| use League\OAuth2\Server\Exception; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
|  | ||||
| /** | ||||
| @@ -41,6 +40,7 @@ abstract class AbstractServer | ||||
|     public function setRequest(Request $request) | ||||
|     { | ||||
|         $this->request = $request; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -59,7 +59,7 @@ abstract class AbstractServer | ||||
|  | ||||
|     /** | ||||
|      * Return a storage class | ||||
|      * @param  string $obj The class required | ||||
|      * @param  string                                                                  $obj The class required | ||||
|      * @return Storage\ClientInterface|Storage\ScopeInterface|Storage\SessionInterface | ||||
|      */ | ||||
|     public function getStorage($obj) | ||||
| @@ -69,6 +69,7 @@ abstract class AbstractServer | ||||
|                 'The `'.$obj.'` storage interface has not been registered with the server' | ||||
|             ); | ||||
|         } | ||||
|  | ||||
|         return $this->storages[$obj]; | ||||
|     } | ||||
| } | ||||
| @@ -11,10 +11,7 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server; | ||||
|  | ||||
| use League\OAuth2\Server\Util\SecureKey; | ||||
| use League\OAuth2\Server\Grant\GrantTypeInterface; | ||||
| use League\OAuth2\Server\Exception; | ||||
| use League\OAuth2\Server\Storage\StorageWrapper; | ||||
| use League\OAuth2\Server\Storage\ClientInterface; | ||||
| use League\OAuth2\Server\Storage\AccessTokenInterface; | ||||
| use League\OAuth2\Server\Storage\AuthCodeInterface; | ||||
| @@ -78,85 +75,92 @@ class AuthorizationServer extends AbstractServer | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->storages = []; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the client storage | ||||
|      * @param ClientInterface $storage | ||||
|      * @param  ClientInterface $storage | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setClientStorage(ClientInterface $storage) | ||||
|     { | ||||
|         $storage->setServer($this); | ||||
|         $this->storages['client'] = $storage; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the session storage | ||||
|      * @param SessionInterface $storage | ||||
|      * @param  SessionInterface $storage | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setSessionStorage(SessionInterface $storage) | ||||
|     { | ||||
|         $storage->setServer($this); | ||||
|         $this->storages['session'] = $storage; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the access token storage | ||||
|      * @param AccessTokenInterface $storage | ||||
|      * @param  AccessTokenInterface $storage | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setAccessTokenStorage(AccessTokenInterface $storage) | ||||
|     { | ||||
|         $storage->setServer($this); | ||||
|         $this->storages['access_token'] = $storage; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the refresh token storage | ||||
|      * @param RefreshTokenInteface $storage | ||||
|      * @param  RefreshTokenInteface $storage | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setRefreshTokenStorage(RefreshTokenInterface $storage) | ||||
|     { | ||||
|         $storage->setServer($this); | ||||
|         $this->storages['refresh_token'] = $storage; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the auth code storage | ||||
|      * @param AuthCodeInterface $authCode | ||||
|      * @param  AuthCodeInterface $authCode | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setAuthCodeStorage(AuthCodeInterface $storage) | ||||
|     { | ||||
|         $storage->setServer($this); | ||||
|         $this->storages['auth_code'] = $storage; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the scope storage | ||||
|      * @param ScopeInterface $storage | ||||
|      * @param  ScopeInterface $storage | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setScopeStorage(ScopeInterface $storage) | ||||
|     { | ||||
|         $storage->setServer($this); | ||||
|         $this->storages['scope'] = $storage; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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) | ||||
| @@ -204,6 +208,7 @@ class AuthorizationServer extends AbstractServer | ||||
|     public function requireScopeParam($require = true) | ||||
|     { | ||||
|         $this->requireScopeParam = $require; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -224,6 +229,7 @@ class AuthorizationServer extends AbstractServer | ||||
|     public function setDefaultScope($default = null) | ||||
|     { | ||||
|         $this->defaultScope = $default; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -254,6 +260,7 @@ class AuthorizationServer extends AbstractServer | ||||
|     public function requireStateParam($require = true) | ||||
|     { | ||||
|         $this->requireStateParam = $require; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -273,6 +280,7 @@ class AuthorizationServer extends AbstractServer | ||||
|     public function setScopeDelimeter($scopeDelimeter = ' ') | ||||
|     { | ||||
|         $this->scopeDelimeter = $scopeDelimeter; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -292,6 +300,7 @@ class AuthorizationServer extends AbstractServer | ||||
|     public function setAccessTokenTTL($accessTokenTTL = 3600) | ||||
|     { | ||||
|         $this->accessTokenTTL = $accessTokenTTL; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -317,7 +326,7 @@ class AuthorizationServer extends AbstractServer | ||||
|  | ||||
|     /** | ||||
|      * Return a grant type class | ||||
|      * @param  string $grantType The grant type identifer | ||||
|      * @param  string                   $grantType The grant type identifer | ||||
|      * @return Grant\GrantTypeInterface | ||||
|      */ | ||||
|     public function getGrantType($grantType) | ||||
|   | ||||
| @@ -11,9 +11,7 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Storage\SessionStorageInterface; | ||||
| use League\OAuth2\Server\Util\SecureKey; | ||||
| use League\OAuth2\Server\Exception\ServerException; | ||||
| use League\OAuth2\Server\AbstractServer; | ||||
| use Symfony\Component\HttpFoundation\ParameterBag; | ||||
|  | ||||
| @@ -54,34 +52,37 @@ abstract class AbstractTokenEntity | ||||
|  | ||||
|     /** | ||||
|      * __construct | ||||
|      * @param \League\OAuth2\Server\AbstractServer $server | ||||
|      * @param  \League\OAuth2\Server\AbstractServer $server | ||||
|      * @return self | ||||
|      */ | ||||
|     public function __construct(AbstractServer $server) | ||||
|     { | ||||
|         $this->server = $server; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set session | ||||
|      * @param \League\OAuth2\Server\SessionEntity $session | ||||
|      * @param  \League\OAuth2\Server\SessionEntity $session | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setSession(SessionEntity $session) | ||||
|     { | ||||
|         $this->session = $session; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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) | ||||
|     { | ||||
|         $this->expireTime = $expireTime; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -96,12 +97,13 @@ abstract class AbstractTokenEntity | ||||
|  | ||||
|     /** | ||||
|      * Set access token ID | ||||
|      * @param string $token Token ID | ||||
|      * @param  string $token Token ID | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setToken($token = null) | ||||
|     { | ||||
|         $this->token = ($token !== null) ? $token : SecureKey::generate(); | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -116,7 +118,7 @@ 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) | ||||
| @@ -141,6 +143,7 @@ abstract class AbstractTokenEntity | ||||
|                 $scopes[$scope->getId()] = $scope; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $scopes; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -11,12 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Storage\SessionStorageInterface; | ||||
| use League\OAuth2\Server\Storage\AccessTokenInterface; | ||||
| use League\OAuth2\Server\Util\SecureKey; | ||||
| use League\OAuth2\Server\Exception\InvalidAccessTokenException; | ||||
| use Symfony\Component\HttpFoundation\ParameterBag; | ||||
|  | ||||
| /** | ||||
|  * Access token entity class | ||||
|  */ | ||||
| @@ -33,12 +27,13 @@ class AccessTokenEntity extends AbstractTokenEntity | ||||
|         } | ||||
|  | ||||
|         $this->session = $this->server->getStorage('session')->getByAccessToken($this); | ||||
|  | ||||
|         return $this->session; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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) | ||||
|   | ||||
| @@ -11,12 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Storage\SessionStorageInterface; | ||||
| use League\OAuth2\Server\Storage\AccessTokenInterface; | ||||
| use League\OAuth2\Server\Util\SecureKey; | ||||
| use League\OAuth2\Server\Exception\InvalidAccessTokenException; | ||||
| use Symfony\Component\HttpFoundation\ParameterBag; | ||||
|  | ||||
| /** | ||||
|  * Access token entity class | ||||
|  */ | ||||
| @@ -30,18 +24,19 @@ class AuthCodeEntity extends AbstractTokenEntity | ||||
|  | ||||
|     /** | ||||
|      * Set the redirect URI for the authorization request | ||||
|      * @param string $redirectUri | ||||
|      * @return  self | ||||
|      * @param  string $redirectUri | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setRedirectUri($redirectUri) | ||||
|     { | ||||
|         $this->redirectUri = $redirectUri; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the redirect URI | ||||
|      * @return  string | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getRedirectUri() | ||||
|     { | ||||
| @@ -58,6 +53,7 @@ class AuthCodeEntity extends AbstractTokenEntity | ||||
|     { | ||||
|         $uri = $this->getRedirectUri(); | ||||
|         $uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&'; | ||||
|  | ||||
|         return $uri.http_build_query([ | ||||
|             'code'  =>  $this->getToken(), | ||||
|             'state' =>  $state | ||||
| @@ -74,6 +70,7 @@ class AuthCodeEntity extends AbstractTokenEntity | ||||
|         } | ||||
|  | ||||
|         $this->session = $this->server->getStorage('session')->getByAuthCode($this); | ||||
|  | ||||
|         return $this->session; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -11,7 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Exception\ServerException; | ||||
| use League\OAuth2\Server\AbstractServer; | ||||
|  | ||||
| /** | ||||
| @@ -51,23 +50,25 @@ class ClientEntity | ||||
|  | ||||
|     /** | ||||
|      * __construct | ||||
|      * @param \League\OAuth2\Server\AbstractServer $server | ||||
|      * @param  \League\OAuth2\Server\AbstractServer $server | ||||
|      * @return self | ||||
|      */ | ||||
|     public function __construct(AbstractServer $server) | ||||
|     { | ||||
|         $this->server = $server; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the client identifier | ||||
|      * @param string $id | ||||
|      * @param  string $id | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setId($id) | ||||
|     { | ||||
|         $this->id = $id; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -82,12 +83,13 @@ class ClientEntity | ||||
|  | ||||
|     /** | ||||
|      * Set the client secret | ||||
|      * @param string $secret | ||||
|      * @param  string $secret | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setSecret($secret) | ||||
|     { | ||||
|         $this->secret = $secret; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -102,12 +104,13 @@ class ClientEntity | ||||
|  | ||||
|     /** | ||||
|      * Set the client name | ||||
|      * @param string $name | ||||
|      * @param  string $name | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setName($name) | ||||
|     { | ||||
|         $this->name = $name; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -122,12 +125,13 @@ class ClientEntity | ||||
|  | ||||
|     /** | ||||
|      * Set the client redirect URI | ||||
|      * @param string $redirectUri | ||||
|      * @param  string $redirectUri | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setRedirectUri($redirectUri) | ||||
|     { | ||||
|         $this->redirectUri = $redirectUri; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -11,12 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Storage\SessionStorageInterface; | ||||
| use League\OAuth2\Server\Storage\RefreshTokenInterface; | ||||
| use League\OAuth2\Server\Util\SecureKey; | ||||
| use League\OAuth2\Server\Exception\InvalidAccessTokenException; | ||||
| use Symfony\Component\HttpFoundation\ParameterBag; | ||||
|  | ||||
| /** | ||||
|  * Refresh token entity class | ||||
|  */ | ||||
| @@ -30,12 +24,13 @@ class RefreshTokenEntity extends AbstractTokenEntity | ||||
|  | ||||
|     /** | ||||
|      * Associate an access token | ||||
|      * @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken | ||||
|      * @param  \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setAccessToken(AccessTokenEntity $accessToken) | ||||
|     { | ||||
|         $this->accessToken = $accessToken; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -48,6 +43,7 @@ class RefreshTokenEntity extends AbstractTokenEntity | ||||
|         if (! $this->accessToken instanceof AccessTokenEntity) { | ||||
|             $this->accessToken = $this->server->getStorage('access_token')->getByRefreshToken($this); | ||||
|         } | ||||
|  | ||||
|         return $this->accessToken; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -11,7 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Exception\ServerException; | ||||
| use League\OAuth2\Server\AbstractServer; | ||||
|  | ||||
| /** | ||||
| @@ -39,23 +38,25 @@ class ScopeEntity | ||||
|  | ||||
|     /** | ||||
|      * __construct | ||||
|      * @param \League\OAuth2\Server\AbstractServer $server | ||||
|      * @param  \League\OAuth2\Server\AbstractServer $server | ||||
|      * @return self | ||||
|      */ | ||||
|     public function __construct(AbstractServer $server) | ||||
|     { | ||||
|         $this->server = $server; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the scope identifer | ||||
|      * @param string $id The scope identifier | ||||
|      * @param  string $id The scope identifier | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setId($id) | ||||
|     { | ||||
|         $this->id = $id; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -70,12 +71,13 @@ class ScopeEntity | ||||
|  | ||||
|     /** | ||||
|      * Set the scope's descripton | ||||
|      * @param string $description | ||||
|      * @param  string $description | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setDescription($description) | ||||
|     { | ||||
|         $this->description = $description; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -11,9 +11,6 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Entity; | ||||
|  | ||||
| use League\OAuth2\Server\Exception\OAuth2Exception; | ||||
| use League\OAuth2\Server\Storage\SessionInterface; | ||||
| use League\OAuth2\Server\Exception\ServerException; | ||||
| use League\OAuth2\Server\AbstractServer; | ||||
| use Symfony\Component\HttpFoundation\ParameterBag; | ||||
|  | ||||
| @@ -78,23 +75,25 @@ class SessionEntity | ||||
|  | ||||
|     /** | ||||
|      * __construct | ||||
|      * @param \League\OAuth2\Server\AbstractServer $server | ||||
|      * @param  \League\OAuth2\Server\AbstractServer $server | ||||
|      * @return self | ||||
|      */ | ||||
|     public function __construct(AbstractServer $server) | ||||
|     { | ||||
|         $this->server = $server; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the session identifier | ||||
|      * @param string $id | ||||
|      * @param  string $id | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setId($id) | ||||
|     { | ||||
|         $this->id = $id; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -109,7 +108,7 @@ 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) | ||||
| @@ -123,7 +122,7 @@ 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) | ||||
| @@ -163,6 +162,7 @@ class SessionEntity | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $scopes; | ||||
|     } | ||||
|  | ||||
| @@ -174,6 +174,7 @@ class SessionEntity | ||||
|     public function associateAccessToken(AccessTokenEntity $accessToken) | ||||
|     { | ||||
|         $this->accessToken = $accessToken; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -185,6 +186,7 @@ class SessionEntity | ||||
|     public function associateRefreshToken(RefreshTokenEntity $refreshToken) | ||||
|     { | ||||
|         $this->refreshToken = $refreshToken; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -196,6 +198,7 @@ class SessionEntity | ||||
|     public function associateClient(ClientEntity $client) | ||||
|     { | ||||
|         $this->client = $client; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -210,13 +213,14 @@ class SessionEntity | ||||
|         } | ||||
|  | ||||
|         $this->client = $this->server->getStorage('client')->getBySession($this); | ||||
|  | ||||
|         return $this->client; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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) | ||||
|   | ||||
| @@ -36,7 +36,7 @@ class OAuthException extends \Exception | ||||
|  | ||||
|     /** | ||||
|      * Get all headers that have to be send with the error response | ||||
|      * @return array         Array with header values | ||||
|      * @return array Array with header values | ||||
|      */ | ||||
|     public function getHttpHeaders() | ||||
|     { | ||||
| @@ -86,7 +86,6 @@ class OAuthException extends \Exception | ||||
|             } | ||||
|         } | ||||
|         // @codeCoverageIgnoreEnd | ||||
|  | ||||
|         return $headers; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -61,12 +61,13 @@ abstract class AbstractGrant implements GrantTypeInterface | ||||
|  | ||||
|     /** | ||||
|      * Return the identifier | ||||
|      * @param string $identifier | ||||
|      * @param  string $identifier | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setIdentifier($identifier) | ||||
|     { | ||||
|         $this->identifier = $identifier; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| @@ -81,29 +82,31 @@ abstract class AbstractGrant implements GrantTypeInterface | ||||
|  | ||||
|     /** | ||||
|      * Override the default access token expire time | ||||
|      * @param int $accessTokenTTL | ||||
|      * @param  int  $accessTokenTTL | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setAccessTokenTTL($accessTokenTTL) | ||||
|     { | ||||
|         $this->accessTokenTTL = $accessTokenTTL; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Inject the authorization server into the grant | ||||
|      * @param AuthorizationServer $server The authorization server instance | ||||
|      * @return  self | ||||
|      * @param  AuthorizationServer $server The authorization server instance | ||||
|      * @return self | ||||
|      */ | ||||
|     public function setAuthorizationServer(AuthorizationServer $server) | ||||
|     { | ||||
|         $this->server = $server; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Given a list of scopes, validate them and return an arrary of Scope entities | ||||
|      * @param string $scopeParam A string of scopes (e.g. "profile email birthday") | ||||
|      * @param  string          $scopeParam A string of scopes (e.g. "profile email birthday") | ||||
|      * @return array | ||||
|      * @throws ClientException If scope is invalid, or no scopes passed when required | ||||
|      */ | ||||
| @@ -161,6 +164,7 @@ abstract class AbstractGrant implements GrantTypeInterface | ||||
|                 $scopes[$scope->getId()] = $scope; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $scopes; | ||||
|     } | ||||
|  | ||||
| @@ -170,15 +174,15 @@ abstract class AbstractGrant implements GrantTypeInterface | ||||
|      * Example response: | ||||
|      * <pre> | ||||
|      *  array( | ||||
|      *      'access_token'  =>  (string),   // The access token | ||||
|      *      'refresh_token' =>  (string),   // The refresh token (only set if the refresh token grant is enabled) | ||||
|      *      'access_token'  =>  (string) ,   // The access token | ||||
|      *      'refresh_token' =>  (string) ,   // The refresh token (only set if the refresh token grant is enabled) | ||||
|      *      'token_type'    =>  'bearer',   // Almost always "bearer" (exceptions: JWT, SAML) | ||||
|      *      'expires'       =>  (int),      // The timestamp of when the access token will expire | ||||
|      *      'expires_in'    =>  (int)       // The number of seconds before the access token will expire | ||||
|      *      'expires'       =>  (int) ,      // The timestamp of when the access token will expire | ||||
|      *      'expires_in'    =>  (int) // The number of seconds before the access token will expire | ||||
|      *  ) | ||||
|      * </pre> | ||||
|      * | ||||
|      * @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 | ||||
|      */ | ||||
|     abstract public function completeFlow(); | ||||
|  | ||||
|   | ||||
| @@ -11,19 +11,14 @@ | ||||
|  | ||||
| namespace League\OAuth2\Server\Grant; | ||||
|  | ||||
| use League\OAuth2\Server\AuthorizationServer; | ||||
| use League\OAuth2\Server\Request; | ||||
| use League\OAuth2\Server\Exception; | ||||
| use League\OAuth2\Server\Entity\ClientEntity; | ||||
| use League\OAuth2\Server\Entity\RefreshTokenEntity; | ||||
| use League\OAuth2\Server\Entity\SessionEntity; | ||||
| use League\OAuth2\Server\Entity\AccessTokenEntity; | ||||
| use League\OAuth2\Server\Entity\ScopeEntity; | ||||
| use League\OAuth2\Server\Entity\AuthCodeEntity; | ||||
| use League\OAuth2\Server\Util\SecureKey; | ||||
| use League\OAuth2\Server\Storage\SessionInterface; | ||||
| use League\OAuth2\Server\Storage\ClientInterface; | ||||
| use League\OAuth2\Server\Storage\ScopeInterface; | ||||
|  | ||||
| /** | ||||
|  * Auth code grant class | ||||
| @@ -62,7 +57,7 @@ class AuthCodeGrant extends AbstractGrant | ||||
|  | ||||
|     /** | ||||
|      * Override the default access token expire time | ||||
|      * @param int $authTokenTTL | ||||
|      * @param  int  $authTokenTTL | ||||
|      * @return void | ||||
|      */ | ||||
|     public function setAuthTokenTTL($authTokenTTL) | ||||
| @@ -132,10 +127,10 @@ class AuthCodeGrant extends AbstractGrant | ||||
|     /** | ||||
|      * Parse a new authorise request | ||||
|      * | ||||
|      * @param  string $type        The session owner's type | ||||
|      * @param  string $typeId      The session owner's ID | ||||
|      * @param  array  $authParams  The authorise request $_GET parameters | ||||
|      * @return string              An authorisation code | ||||
|      * @param  string $type       The session owner's type | ||||
|      * @param  string $typeId     The session owner's ID | ||||
|      * @param  array  $authParams The authorise request $_GET parameters | ||||
|      * @return string An authorisation code | ||||
|      */ | ||||
|     public function newAuthoriseRequest($type, $typeId, $authParams = []) | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user