Files
oauth2-server/examples/src/Repositories/RefreshTokenRepository.php
2016-04-17 13:06:05 +01:00

50 lines
1.2 KiB
PHP

<?php
/**
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
*
* @link https://github.com/thephpleague/oauth2-server
*/
namespace OAuth2ServerExamples\Repositories;
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface;
use OAuth2ServerExamples\Entities\RefreshTokenEntity;
class RefreshTokenRepository implements RefreshTokenRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntityInterface)
{
// Some logic to persist the refresh token in a database
}
/**
* {@inheritdoc}
*/
public function revokeRefreshToken($tokenId)
{
// Some logic to revoke the refresh token in a database
}
/**
* {@inheritdoc}
*/
public function isRefreshTokenRevoked($tokenId)
{
return false; // The refresh token has not been revoked
}
/**
* {@inheritdoc}
*/
public function getNewRefreshToken()
{
return new RefreshTokenEntity();
}
}