mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-02-08 17:56:35 +05:30
Updated RefreshToken methods
This commit is contained in:
parent
5f9feda80c
commit
6339524c86
@ -1,17 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace League\OAuth2\Server\Entities\Interfaces;
|
namespace League\OAuth2\Server\Entities\Interfaces;
|
||||||
|
|
||||||
interface RefreshTokenEntityInterface extends TokenInterface
|
interface RefreshTokenEntityInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Set the original access token that the refresh token was associated with
|
* Get the token's identifier
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIdentifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the token's identifier
|
||||||
|
* @param $identifier
|
||||||
|
*/
|
||||||
|
public function setIdentifier($identifier);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the token's expiry date time
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getExpiryDateTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the date time when the token expires
|
||||||
|
* @param \DateTime $dateTime
|
||||||
|
*/
|
||||||
|
public function setExpiryDateTime(\DateTime $dateTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the access token that the refresh token was associated with
|
||||||
|
*
|
||||||
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken
|
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken
|
||||||
*/
|
*/
|
||||||
public function setOriginalAccessToken(AccessTokenEntityInterface $accessToken);
|
public function setAccessToken(AccessTokenEntityInterface $accessToken);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the access token that the refresh token was originally associated with
|
* Get the access token that the refresh token was originally associated with
|
||||||
* @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface
|
* @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface
|
||||||
*/
|
*/
|
||||||
public function getOriginalAccessToken();
|
public function getAccessToken();
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,5 @@ use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
|
|||||||
*/
|
*/
|
||||||
class RefreshTokenEntity implements RefreshTokenEntityInterface
|
class RefreshTokenEntity implements RefreshTokenEntityInterface
|
||||||
{
|
{
|
||||||
use EntityTrait, TokenEntityTrait, RefreshTokenTrait;
|
use EntityTrait, RefreshTokenTrait;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace League\OAuth2\Server\Entities\Traits;
|
namespace League\OAuth2\Server\Entities\Traits;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface;
|
use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface;
|
||||||
|
|
||||||
trait RefreshTokenTrait
|
trait RefreshTokenTrait
|
||||||
@ -8,23 +9,45 @@ trait RefreshTokenTrait
|
|||||||
/**
|
/**
|
||||||
* @var AccessTokenEntityInterface
|
* @var AccessTokenEntityInterface
|
||||||
*/
|
*/
|
||||||
protected $originalAccessToken;
|
protected $accessToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the original access token that the refresh token was associated with
|
* @var DateTime
|
||||||
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken
|
|
||||||
*/
|
*/
|
||||||
public function setOriginalAccessToken(AccessTokenEntityInterface $accessToken)
|
protected $expiryDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function setAccessToken(AccessTokenEntityInterface $accessToken)
|
||||||
{
|
{
|
||||||
$this->originalAccessToken = $accessToken;
|
$this->accessToken = $accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the access token that the refresh token was originally associated with
|
* @inheritdoc
|
||||||
* @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface
|
|
||||||
*/
|
*/
|
||||||
public function getOriginalAccessToken()
|
public function getAccessToken()
|
||||||
{
|
{
|
||||||
return $this->originalAccessToken;
|
return $this->accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the token's expiry date time
|
||||||
|
* @return DateTime
|
||||||
|
*/
|
||||||
|
public function getExpiryDateTime()
|
||||||
|
{
|
||||||
|
return $this->expiryDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the date time when the token expires
|
||||||
|
*
|
||||||
|
* @param DateTime $dateTime
|
||||||
|
*/
|
||||||
|
public function setExpiryDateTime(DateTime $dateTime)
|
||||||
|
{
|
||||||
|
$this->expiryDateTime = $dateTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user