Changed default mercure token duration to 1 day

This commit is contained in:
Alejandro Celaya 2020-04-18 11:29:49 +02:00
parent 655fd58a9d
commit 078c8ea011
3 changed files with 2 additions and 3 deletions

View File

@ -13,7 +13,6 @@ return [
'public_hub_url' => null, 'public_hub_url' => null,
'internal_hub_url' => null, 'internal_hub_url' => null,
'jwt_secret' => null, 'jwt_secret' => null,
'jwt_days_duration' => 5,
'jwt_issuer' => 'Shlink', 'jwt_issuer' => 'Shlink',
], ],

View File

@ -40,7 +40,7 @@ class MercureInfoAction extends AbstractRestAction
throw MercureException::mercureNotConfigured(); throw MercureException::mercureNotConfigured();
} }
$days = $this->mercureConfig['jwt_days_duration'] ?? 3; $days = $this->mercureConfig['jwt_days_duration'] ?? 1;
$expiresAt = Chronos::now()->addDays($days); $expiresAt = Chronos::now()->addDays($days);
try { try {

View File

@ -92,7 +92,7 @@ class MercureInfoActionTest extends TestCase
$this->assertArrayHasKey('token', $payload); $this->assertArrayHasKey('token', $payload);
$this->assertArrayHasKey('jwtExpiration', $payload); $this->assertArrayHasKey('jwtExpiration', $payload);
$this->assertEquals( $this->assertEquals(
Chronos::now()->addDays($days ?? 3)->startOfDay(), Chronos::now()->addDays($days ?? 1)->startOfDay(),
Chronos::parse($payload['jwtExpiration'])->startOfDay(), Chronos::parse($payload['jwtExpiration'])->startOfDay(),
); );
$buildToken->shouldHaveBeenCalledOnce(); $buildToken->shouldHaveBeenCalledOnce();