Skip to content

[v2] Multi-auth trait support#8942

Merged
aemous merged 9 commits intoaws:v2from
aemous:multi-auth-trait-support
Oct 30, 2024
Merged

[v2] Multi-auth trait support#8942
aemous merged 9 commits intoaws:v2from
aemous:multi-auth-trait-support

Conversation

@aemous
Copy link
Copy Markdown
Contributor

@aemous aemous commented Sep 24, 2024

Issue #, if available:

Description of changes:

  • Ported the linked botocore PRs above to add multi-auth trait support

Description of tests:

  • Passed the unit/functional tests provided with the original commit.
  • Manually tested specifying multiple auth types in an overridden (ECS) service model. Logs are shown below to verify this:
  • Manually tested specifying the environment variable AWS_SIGV4A_SIGNING_REGION_SET and config variable sigv4a_signing_region_set and verified the X-Amz-Region-Set headers were properly updated in requests.

"auth":["aws.auth#sigv4a", "aws.auth#sigv4", "smithy.api#httpBearerAuth"]

<AWSPreparedRequest stream_output=False, method=POST, url=https://ecs.us-west-2.amazonaws.com/, headers={'X-Amz-Target': b'AmazonEC2ContainerServiceV20141113.CreateCluster', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'aws-cli/2.17.57 md/awscrt#0.21.2 ua/2.0 os/macos#23.6.0 md/arch#arm64 lang/python#3.12.4 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#ecs.create-cluster', 'host': b'ecs.us-west-2.amazonaws.com', 'X-Amz-Security-Token': b'REDACTED', 'X-Amz-Date': b'20240925T153938Z', 'X-Amz-Region-Set': b'us-west-2', 'Authorization': b'AWS4-ECDSA-P256-SHA256 Credential=REDACTED, SignedHeaders=content-type;host;x-amz-date;x-amz-region-set;x-amz-security-token;x-amz-target, Signature=3044022063bdd92d8b01f913ac2f26c1f924701a0b45067ff0a36e647d11cdd23def86b8022029c22a6b7b762d1caf095c25043c9a579322a983acc488ae04abf7fcfaa34b07', 'Content-Length': '2'}>

"auth":["aws.auth#sigv4", "smithy.api#httpBearerAuth"]

<AWSPreparedRequest stream_output=False, method=POST, url=https://ecs.us-west-2.amazonaws.com/, headers={'X-Amz-Target': b'AmazonEC2ContainerServiceV20141113.CreateCluster', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'aws-cli/2.17.57 md/awscrt#0.21.2 ua/2.0 os/macos#23.6.0 md/arch#arm64 lang/python#3.12.4 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#ecs.create-cluster', 'X-Amz-Date': b'20240925T153823Z', 'X-Amz-Security-Token': b'REDACTED', 'Authorization': b'AWS4-HMAC-SHA256 Credential=REDACTED, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=3ef073a161442c4f35a6c0d952ba8f823cd5cc4dd2a3c90a1aa804a99223714e', 'Content-Length': '2'}>

"auth":["smithy.api#httpBearerAuth"]

File "/awscli/botocore/auth.py", line 845, in add_auth
    raise NoAuthTokenError()
botocore.exceptions.NoAuthTokenError: Unable to locate authorization token

(This error verifies that the port works for singleton list of bearer since it requested the token in the first place)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aemous aemous requested review from a team and aws-sdk-python-automation September 24, 2024 15:43
@aemous aemous marked this pull request as draft September 30, 2024 19:16
@aemous aemous force-pushed the multi-auth-trait-support branch from 6974a20 to 84d0b47 Compare October 1, 2024 19:21
@aemous aemous marked this pull request as ready for review October 1, 2024 19:23
@aemous aemous force-pushed the multi-auth-trait-support branch from 84d0b47 to 0ed740b Compare October 16, 2024 14:13
@kdaily
Copy link
Copy Markdown
Member

kdaily commented Oct 30, 2024

Looks good! We should clean up some commit history before merging, but otherwise its 🚢

@aemous aemous merged commit 9e6b1c4 into aws:v2 Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants