2016-07-04 14:45:18 +02:00
|
|
|
<?php
|
2016-07-19 17:07:59 +02:00
|
|
|
namespace Shlinkio\Shlink\Rest\Service;
|
2016-07-04 14:45:18 +02:00
|
|
|
|
2016-07-19 18:01:39 +02:00
|
|
|
use Shlinkio\Shlink\Core\Entity\RestToken;
|
|
|
|
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
2016-07-19 17:27:55 +02:00
|
|
|
use Shlinkio\Shlink\Rest\Exception\AuthenticationException;
|
2016-07-04 14:45:18 +02:00
|
|
|
|
|
|
|
|
interface RestTokenServiceInterface
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @param string $token
|
|
|
|
|
* @return RestToken
|
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
|
*/
|
|
|
|
|
public function getByToken($token);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and returns a new RestToken if username and password are correct
|
|
|
|
|
* @param $username
|
|
|
|
|
* @param $password
|
|
|
|
|
* @return RestToken
|
|
|
|
|
* @throws AuthenticationException
|
|
|
|
|
*/
|
|
|
|
|
public function createToken($username, $password);
|
2016-07-04 17:54:24 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updates the expiration of provided token, extending its life
|
|
|
|
|
*
|
|
|
|
|
* @param RestToken $token
|
|
|
|
|
*/
|
|
|
|
|
public function updateExpiration(RestToken $token);
|
2016-07-04 14:45:18 +02:00
|
|
|
}
|