From 041bc4a32b19a5855a92e2b95a3931da602ba07c Mon Sep 17 00:00:00 2001 From: Yuyutsu Rai <113098086+Yuyuutsu@users.noreply.github.com> Date: Fri, 14 Apr 2023 10:55:04 +0100 Subject: [PATCH] Set response_expires_at field to Payload (#129) Co-authored-by: Mebin Abraham <35296336+MebinAbraham@users.noreply.github.com> --- runner_benchmark/token_generator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runner_benchmark/token_generator.py b/runner_benchmark/token_generator.py index 48e0213d..2e6714b6 100644 --- a/runner_benchmark/token_generator.py +++ b/runner_benchmark/token_generator.py @@ -1,7 +1,7 @@ import os import time from uuid import uuid4 - +from datetime import datetime, timedelta, timezone from sdc.crypto.encrypter import encrypt from sdc.crypto.key_store import KeyStore @@ -76,7 +76,9 @@ def _get_payload_with_params(schema_name, schema_url=None, **extra_payload): payload_vars['iat'] = time.time() payload_vars['exp'] = payload_vars['iat'] + float(3600) # one hour from now payload_vars['jti'] = str(uuid4()) - + payload_vars['response_expires_at'] = ( + datetime.now(tz=timezone.utc) + timedelta(days=7) + ).isoformat() # 7 days from now in ISO 8601 format for key, value in extra_payload.items(): payload_vars[key] = value