-
Notifications
You must be signed in to change notification settings - Fork 870
Add Support for Multiple Auth Schemes and SigV4a #3999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
5a8d2fb
c591ddd
1201ab6
20730ab
c33aa26
fb989a0
1490cdb
c6c4013
f1cf998
baa0916
4659c51
1327bbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "core": { | ||
| "changeLogMessages": [ | ||
| "Added ability to configure authentication scheme preferences (e.g., prioritize SigV4a over SigV4)", | ||
| "Added support for AWS_AUTH_SCHEME_PREFERENCE environment variable and auth_scheme_preference configuration file setting", | ||
| "Added support for AWS_SIGV4A_SIGNING_REGION_SET environment variable and sigv4a_signing_region_set profile key to configure SigV4a signing region set" | ||
| ], | ||
| "type": "minor", | ||
| "updateMinimum": true, | ||
| "backwardIncompatibilitiesToIgnore": [ | ||
| "Amazon.Runtime.Internal.IRequest/MethodAbstractMethodAdded", | ||
| "Amazon.Runtime.IClientConfig/MethodAbstractMethodAdded", | ||
| "Amazon.Runtime.IRequestContext/MethodAbstractMethodAdded" | ||
| ] | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+16
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,8 @@ public abstract partial class ClientConfig : IClientConfig | |
| private string serviceURL = null; | ||
| private string authRegion = null; | ||
| private string authServiceName = null; | ||
| private string authSchemePreference = null; | ||
| private string sigV4aSigningRegionSet = null; | ||
| private string clientAppId = null; | ||
| private SigningAlgorithm signatureMethod = SigningAlgorithm.HmacSHA256; | ||
| private bool logResponse = false; | ||
|
|
@@ -444,6 +446,46 @@ public string AuthenticationServiceName | |
| get { return this.authServiceName; } | ||
| set { this.authServiceName = value; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets and sets the AuthSchemePreference property. | ||
| /// A comma-separated list of authentication scheme names to use in order of preference. | ||
| /// For example: "sigv4a,sigv4" to prefer SigV4a over SigV4. | ||
| /// </summary> | ||
| public string AuthSchemePreference | ||
| { | ||
| get | ||
| { | ||
| if (!string.IsNullOrEmpty(this.authSchemePreference)) | ||
| return this.authSchemePreference; | ||
|
|
||
| // Fallback to environment variable or config file: | ||
| // 1. Environment variable: AWS_AUTH_SCHEME_PREFERENCE | ||
|
||
| // 2. Config file: auth_scheme_preference | ||
| return FallbackInternalConfigurationFactory.AuthSchemePreference; | ||
| } | ||
AlexDaines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set { this.authSchemePreference = value; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets and sets the SigV4aSigningRegionSet property. | ||
| /// A comma-separated list of regions that a SigV4a signature will be valid for. | ||
| /// Use "*" to indicate all regions. | ||
| /// </summary> | ||
| public string SigV4aSigningRegionSet | ||
| { | ||
| get | ||
| { | ||
| if (!string.IsNullOrEmpty(this.sigV4aSigningRegionSet)) | ||
| return this.sigV4aSigningRegionSet; | ||
|
|
||
| // Fallback to environment variable or config file: | ||
| // 1. Environment variable: AWS_SIGV4A_SIGNING_REGION_SET | ||
| // 2. Config file: sigv4a_signing_region_set | ||
| return FallbackInternalConfigurationFactory.SigV4aSigningRegionSet; | ||
| } | ||
AlexDaines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| set { this.sigV4aSigningRegionSet = value; } | ||
| } | ||
|
Comment on lines
502
to
551
|
||
|
|
||
| /// <summary> | ||
| /// The serviceId for the service, which is specified in the metadata in the ServiceModel. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,6 +163,20 @@ public partial interface IClientConfig | |
| /// </summary> | ||
| string AuthenticationServiceName { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the AuthSchemePreference property. | ||
| /// A comma-separated list of authentication scheme names to use in order of preference. | ||
| /// For example: "sigv4a,sigv4" to prefer SigV4a over SigV4. | ||
| /// </summary> | ||
| string AuthSchemePreference { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the SigV4aSigningRegionSet property. | ||
| /// A comma-separated list of regions that a SigV4a signature will be valid for. | ||
| /// Use "*" to indicate all regions. | ||
| /// </summary> | ||
| string SigV4aSigningRegionSet { get; } | ||
|
Comment on lines
+166
to
+178
|
||
|
|
||
| /// <summary> | ||
| /// Gets the UserAgent property. | ||
| /// </summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -475,6 +475,13 @@ public string CanonicalResourcePrefix | |
| /// </summary> | ||
| public string AuthenticationRegion { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The signing region set to use for SigV4a requests. | ||
| /// Contains a comma-separated list of regions for multi-region signing. | ||
| /// Set from Config.SigV4aSigningRegionSet or endpoints metadata. | ||
| /// </summary> | ||
| public string SigV4aSigningRegionSet { get; set; } | ||
|
||
|
|
||
| /// <summary> | ||
| /// The region in which the service request was signed. | ||
| /// </summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,7 +338,17 @@ string CanonicalResourcePrefix | |
| string AuthenticationRegion { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The region in which the service request was signed. | ||
| /// The signing region set to use for SigV4a requests. | ||
| /// Contains a comma-separated list of regions for multi-region signing. | ||
| /// Set from Config.SigV4aSigningRegionSet or endpoints metadata. | ||
| /// </summary> | ||
| string SigV4aSigningRegionSet { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The region or region set used for signing the service request. | ||
| /// For standard SigV4 signing, this contains a single region (e.g., "us-west-2"). | ||
| /// For SigV4a multi-region signing, this can be a comma-separated list of regions (e.g., "us-west-2,us-east-1") | ||
|
||
| /// or "*" to indicate the signature is valid for all regions. | ||
| /// </summary> | ||
| string DeterminedSigningRegion { get; set; } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to create this method instead of using
BuildHeaderRequestToSign?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the real DefaultRequest because CRT modifies the headers directly during signing. The mock version returns an immutable dictionary so the CRT can't add headers to it. The tests check that those headers actually got added to the request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sure we actually need to change any tests in the extensions folder.