Got rid of mystery $identifier class property, moved it to the getIdentifier method

This commit is contained in:
Alex Bilbie 2016-02-12 08:33:59 +00:00
parent ca776e83a2
commit d96f57d27f
5 changed files with 26 additions and 38 deletions

View File

@ -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()
);
}
}

View File

@ -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';
}
}

View File

@ -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
*/

View File

@ -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';
}
}

View File

@ -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';
}
}