Skip to content

Commit fb390f9

Browse files
RudneiBertolJrrbertol
authored andcommitted
Change datetime to use utc as timestamp instead of local timezone
Fixing the issue reported at AAP-62956
1 parent c2b4616 commit fb390f9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ansible_base/resource_registry/resource_server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from datetime import datetime, timedelta
1+
from datetime import timedelta
22
from typing import TypedDict
33

44
import jwt
55
from django.conf import settings
6+
from django.utils.timezone import now
67

78
from ansible_base.resource_registry.models import service_id
89

@@ -31,6 +32,6 @@ def get_service_token(user_id=None, expiration=60, **kwargs):
3132
payload["sub"] = user_id
3233

3334
if expiration is not None:
34-
payload["exp"] = datetime.now() + timedelta(seconds=expiration)
35+
payload["exp"] = now() + timedelta(seconds=expiration)
3536

3637
return jwt.encode(payload, config["SECRET_KEY"], config["JWT_ALGORITHM"])

0 commit comments

Comments
 (0)