Implement tests, fix JWT maxAge

This commit is contained in:
Matej Bačo
2024-05-28 09:25:54 +00:00
parent 613677e9f7
commit b1ff989c3f
9 changed files with 178 additions and 23 deletions
+2 -1
View File
@@ -284,8 +284,9 @@ class Functions extends Action
$runtime = $runtimes[$function->getAttribute('runtime')];
$jwtExpiry = $function->getAttribute('timeout', 900);
$jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $jwtExpiry, 10);
$jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 3600, 10);
$apiKey = $jwtObj->encode([
'exp' => \intval((new \DateTime())->add(new \DateInterval('PT' . $jwtExpiry . 'S'))->format('U')),
'projectId' => $project->getId(),
'scopes' => $function->getAttribute('scopes', [])
]);