CognitoIdentity: get_credentials_for_identity() should have Expiration as number. (#7059)
This commit is contained in:
parent
3d5929f55e
commit
843c9068ea
@ -5,7 +5,7 @@ import re
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
from moto.core import BaseBackend, BackendDict, BaseModel
|
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 .exceptions import InvalidNameException, ResourceNotFoundError
|
||||||
from .utils import get_random_identity_id
|
from .utils import get_random_identity_id
|
||||||
|
|
||||||
@ -139,12 +139,11 @@ class CognitoIdentityBackend(BaseBackend):
|
|||||||
duration = 90
|
duration = 90
|
||||||
now = utcnow()
|
now = utcnow()
|
||||||
expiration = now + datetime.timedelta(seconds=duration)
|
expiration = now + datetime.timedelta(seconds=duration)
|
||||||
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
|
|
||||||
return json.dumps(
|
return json.dumps(
|
||||||
{
|
{
|
||||||
"Credentials": {
|
"Credentials": {
|
||||||
"AccessKeyId": "TESTACCESSKEY12345",
|
"AccessKeyId": "TESTACCESSKEY12345",
|
||||||
"Expiration": expiration_str,
|
"Expiration": expiration.timestamp(),
|
||||||
"SecretKey": "ABCSECRETKEY",
|
"SecretKey": "ABCSECRETKEY",
|
||||||
"SessionToken": "ABC12345",
|
"SessionToken": "ABC12345",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user