mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
CS fixer changes
This commit is contained in:
parent
193018aecf
commit
97e7a00bca
@ -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;
|
||||
}
|
||||
|
||||
@ -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,6 +75,7 @@ class AuthorizationServer extends AbstractServer
|
||||
public function __construct()
|
||||
{
|
||||
$this->storages = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -90,6 +88,7 @@ class AuthorizationServer extends AbstractServer
|
||||
{
|
||||
$storage->setServer($this);
|
||||
$this->storages['client'] = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -102,6 +101,7 @@ class AuthorizationServer extends AbstractServer
|
||||
{
|
||||
$storage->setServer($this);
|
||||
$this->storages['session'] = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -114,6 +114,7 @@ class AuthorizationServer extends AbstractServer
|
||||
{
|
||||
$storage->setServer($this);
|
||||
$this->storages['access_token'] = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -126,6 +127,7 @@ class AuthorizationServer extends AbstractServer
|
||||
{
|
||||
$storage->setServer($this);
|
||||
$this->storages['refresh_token'] = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -138,6 +140,7 @@ class AuthorizationServer extends AbstractServer
|
||||
{
|
||||
$storage->setServer($this);
|
||||
$this->storages['auth_code'] = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -150,6 +153,7 @@ class AuthorizationServer extends AbstractServer
|
||||
{
|
||||
$storage->setServer($this);
|
||||
$this->storages['scope'] = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
@ -60,6 +58,7 @@ abstract class AbstractTokenEntity
|
||||
public function __construct(AbstractServer $server)
|
||||
{
|
||||
$this->server = $server;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -71,6 +70,7 @@ abstract class AbstractTokenEntity
|
||||
public function setSession(SessionEntity $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -82,6 +82,7 @@ abstract class AbstractTokenEntity
|
||||
public function setExpireTime($expireTime)
|
||||
{
|
||||
$this->expireTime = $expireTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -102,6 +103,7 @@ abstract class AbstractTokenEntity
|
||||
public function setToken($token = null)
|
||||
{
|
||||
$this->token = ($token !== null) ? $token : SecureKey::generate();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -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,6 +27,7 @@ class AccessTokenEntity extends AbstractTokenEntity
|
||||
}
|
||||
|
||||
$this->session = $this->server->getStorage('session')->getByAccessToken($this);
|
||||
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
@ -36,6 +30,7 @@ class AuthCodeEntity extends AbstractTokenEntity
|
||||
public function setRedirectUri($redirectUri)
|
||||
{
|
||||
$this->redirectUri = $redirectUri;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
@ -57,6 +56,7 @@ class ClientEntity
|
||||
public function __construct(AbstractServer $server)
|
||||
{
|
||||
$this->server = $server;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ class ClientEntity
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -88,6 +89,7 @@ class ClientEntity
|
||||
public function setSecret($secret)
|
||||
{
|
||||
$this->secret = $secret;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -108,6 +110,7 @@ class ClientEntity
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -128,6 +131,7 @@ class ClientEntity
|
||||
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
|
||||
*/
|
||||
@ -36,6 +30,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -45,6 +44,7 @@ class ScopeEntity
|
||||
public function __construct(AbstractServer $server)
|
||||
{
|
||||
$this->server = $server;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -56,6 +56,7 @@ class ScopeEntity
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -76,6 +77,7 @@ class ScopeEntity
|
||||
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;
|
||||
|
||||
@ -84,6 +81,7 @@ class SessionEntity
|
||||
public function __construct(AbstractServer $server)
|
||||
{
|
||||
$this->server = $server;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -95,6 +93,7 @@ class SessionEntity
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -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,6 +213,7 @@ class SessionEntity
|
||||
}
|
||||
|
||||
$this->client = $this->server->getStorage('client')->getBySession($this);
|
||||
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,6 @@ class OAuthException extends \Exception
|
||||
}
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return $headers;
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
public function setIdentifier($identifier)
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -87,6 +88,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
public function setAccessTokenTTL($accessTokenTTL)
|
||||
{
|
||||
$this->accessTokenTTL = $accessTokenTTL;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -98,6 +100,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
public function setAuthorizationServer(AuthorizationServer $server)
|
||||
{
|
||||
$this->server = $server;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -161,6 +164,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
$scopes[$scope->getId()] = $scope;
|
||||
}
|
||||
}
|
||||
|
||||
return $scopes;
|
||||
}
|
||||
|
||||
@ -170,10 +174,10 @@ 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' => (int) , // The timestamp of when the access token will expire
|
||||
* 'expires_in' => (int) // The number of seconds before the access token will expire
|
||||
* )
|
||||
* </pre>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user