summaryrefslogtreecommitdiff
path: root/src/services/api/graphql/libs/token_auth.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/api/graphql/libs/token_auth.py')
-rw-r--r--src/services/api/graphql/libs/token_auth.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/services/api/graphql/libs/token_auth.py b/src/services/api/graphql/libs/token_auth.py
index 2d63a1cc7..fafb0f5af 100644
--- a/src/services/api/graphql/libs/token_auth.py
+++ b/src/services/api/graphql/libs/token_auth.py
@@ -14,7 +14,7 @@ def init_secret():
secret = token_hex(16)
state.settings['secret'] = secret
-def generate_token(user: str, passwd: str, secret: str) -> dict:
+def generate_token(user: str, passwd: str, secret: str, exp: int) -> dict:
if user is None or passwd is None:
return {}
if _check_passwd_pam(user, passwd):
@@ -25,7 +25,7 @@ def generate_token(user: str, passwd: str, secret: str) -> dict:
app.state.vyos_token_users = {}
users = app.state.vyos_token_users
user_id = uuid.uuid1().hex
- payload_data = {'iss': user, 'sub': user_id}
+ payload_data = {'iss': user, 'sub': user_id, 'exp': exp}
secret = state.settings.get('secret')
if secret is None:
return {