Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/google-auth/google/auth/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ def _generate_authentication_header_map(
"""
# iam.amazonaws.com host => iam service.
# sts.us-east-2.amazonaws.com host => sts service.
service_name = host.split(".")[0]
# sts-fips.us-east-2.amazonaws.com host => sts service.
service_name = host.split(".")[0].removesuffix("-fips")

current_time = _helpers.utcnow()
amz_date = current_time.strftime("%Y%m%dT%H%M%SZ")
Expand Down
26 changes: 26 additions & 0 deletions packages/google-auth/tests/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,32 @@
"data": REQUEST_PARAMS,
},
),
# POST request with session token credentials and FIPS STS endpoint.
(
"us-east-2",
"2020-08-11T06:55:22Z",
{
"access_key_id": ACCESS_KEY_ID,
"secret_access_key": SECRET_ACCESS_KEY,
"security_token": TOKEN,
},
{
"method": "POST",
"url": "https://sts-fips.us-east-2.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15",
},
{
"url": "https://sts-fips.us-east-2.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15",
"method": "POST",
"headers": {
"Authorization": "AWS4-HMAC-SHA256 Credential="
+ ACCESS_KEY_ID
+ "/20200811/us-east-2/sts/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=9b27e912850bcfdde94f29f05c992022ad6ed0d40b31381a33e0da6cdb4c5a8f",
"host": "sts-fips.us-east-2.amazonaws.com",
"x-amz-date": "20200811T065522Z",
"x-amz-security-token": TOKEN,
},
},
),
]


Expand Down
Loading