CognitoIdentity: get_credentials_for_identity() should have Expiration as number. (#7059)

This commit is contained in:
nonchan 2023-11-24 03:49:28 +09:00 committed by GitHub
parent 3d5929f55e
commit 843c9068ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ import re
from collections import OrderedDict
from typing import Any, Dict, List, Optional
from moto.core import BaseBackend, BackendDict, BaseModel
from moto.core.utils import iso_8601_datetime_with_milliseconds, utcnow
from moto.core.utils import utcnow
from .exceptions import InvalidNameException, ResourceNotFoundError
from .utils import get_random_identity_id
@ -139,12 +139,11 @@ class CognitoIdentityBackend(BaseBackend):
duration = 90
now = utcnow()
expiration = now + datetime.timedelta(seconds=duration)
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
return json.dumps(
{
"Credentials": {
"AccessKeyId": "TESTACCESSKEY12345",
"Expiration": expiration_str,
"Expiration": expiration.timestamp(),
"SecretKey": "ABCSECRETKEY",
"SessionToken": "ABC12345",
},