mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Got rid of mystery $identifier class property, moved it to the getIdentifier method
This commit is contained in:
parent
ca776e83a2
commit
d96f57d27f
@ -31,13 +31,6 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
{
|
||||
const SCOPE_DELIMITER_STRING = ' ';
|
||||
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = '';
|
||||
|
||||
/**
|
||||
* Grant responds with
|
||||
*
|
||||
@ -141,14 +134,6 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
$this->refreshTokenTTL = $refreshTokenTTL;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -317,7 +302,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
{
|
||||
return (
|
||||
isset($request->getParsedBody()['grant_type'])
|
||||
&& $request->getParsedBody()['grant_type'] === $this->identifier
|
||||
&& $request->getParsedBody()['grant_type'] === $this->getIdentifier()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,6 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||
*/
|
||||
class ClientCredentialsGrant extends AbstractGrant
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = 'client_credentials';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@ -47,4 +40,12 @@ class ClientCredentialsGrant extends AbstractGrant
|
||||
|
||||
return $responseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return 'client_credentials';
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ interface GrantTypeInterface
|
||||
public function setRefreshTokenTTL(\DateInterval $refreshTokenTTL);
|
||||
|
||||
/**
|
||||
* Return the identifier
|
||||
* Return the grant identifier that can be used in matching up requests
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -24,13 +24,6 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||
*/
|
||||
class PasswordGrant extends AbstractGrant
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = 'password';
|
||||
|
||||
/**
|
||||
* @var \League\OAuth2\Server\Repositories\UserRepositoryInterface
|
||||
*/
|
||||
@ -109,4 +102,12 @@ class PasswordGrant extends AbstractGrant
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return 'password';
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,6 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||
*/
|
||||
class RefreshTokenGrant extends AbstractGrant
|
||||
{
|
||||
/**
|
||||
* Grant identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $identifier = 'refresh_token';
|
||||
|
||||
/**
|
||||
* @var \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface
|
||||
*/
|
||||
@ -134,4 +127,12 @@ class RefreshTokenGrant extends AbstractGrant
|
||||
|
||||
return $refreshTokenData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return 'refresh_token';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user