Skip to content

Commit 2aa641e

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 2aa641e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ansible_base/resource_registry/resource_server.py

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

44
import jwt
@@ -31,6 +31,6 @@ def get_service_token(user_id=None, expiration=60, **kwargs):
3131
payload["sub"] = user_id
3232

3333
if expiration is not None:
34-
payload["exp"] = datetime.now() + timedelta(seconds=expiration)
34+
payload["exp"] = datetime.utc(timezone.utc) + timedelta(seconds=expiration)
3535

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

0 commit comments

Comments
 (0)