1
- /*
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License").
5
- * You may not use this file except in compliance with the License.
6
- * A copy of the License is located at
7
- *
8
- * http://aws.amazon.com/apache2.0
9
- *
10
- * or in the "license" file accompanying this file. This file is distributed
11
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- * express or implied. See the License for the specific language governing
13
- * permissions and limitations under the License.
14
- */
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License").
5
+ * You may not use this file except in compliance with the License.
6
+ * A copy of the License is located at
7
+ *
8
+ * http://aws.amazon.com/apache2.0
9
+ *
10
+ * or in the "license" file accompanying this file. This file is distributed
11
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ * express or implied. See the License for the specific language governing
13
+ * permissions and limitations under the License.
14
+ */
15
15
using System ;
16
16
using System . Collections . Generic ;
17
17
using System . Net ;
@@ -68,6 +68,7 @@ public abstract partial class ClientConfig : IClientConfig
68
68
private string authServiceName = null ;
69
69
private string clientAppId = null ;
70
70
private SigningAlgorithm signatureMethod = SigningAlgorithm . HmacSHA256 ;
71
+ private bool isSignatureMethodExplicitlySet = false ;
71
72
private bool logResponse = false ;
72
73
private int bufferSize = AWSSDKUtils . DefaultBufferSize ;
73
74
private long progressUpdateInterval = AWSSDKUtils . DefaultProgressUpdateInterval ;
@@ -221,7 +222,20 @@ public abstract string ServiceVersion
221
222
public SigningAlgorithm SignatureMethod
222
223
{
223
224
get { return this . signatureMethod ; }
224
- set { this . signatureMethod = value ; }
225
+ set {
226
+ this . signatureMethod = value ;
227
+ this . isSignatureMethodExplicitlySet = true ;
228
+ }
229
+ }
230
+
231
+ /// <summary>
232
+ /// Gets a value indicating whether the SignatureMethod property was explicitly set by the user.
233
+ /// This is used for backwards compatibility to determine when legacy SignatureMethod configuration
234
+ /// should take precedence over auth scheme preferences.
235
+ /// </summary>
236
+ public bool IsSignatureMethodExplicitlySet
237
+ {
238
+ get { return this . isSignatureMethodExplicitlySet ; }
225
239
}
226
240
227
241
/// <summary>
@@ -317,18 +331,18 @@ public abstract string RegionEndpointServiceName
317
331
/// </summary>
318
332
public string ServiceURL
319
333
{
320
- get
334
+ get
321
335
{
322
336
if ( ! didProcessServiceURL && this . serviceURL == null && IgnoreConfiguredEndpointUrls == false && ServiceId != null )
323
337
{
324
-
338
+
325
339
string serviceSpecificTransformedEnvironmentVariable = TransformServiceId . TransformServiceIdToEnvVariable ( ServiceId ) ;
326
340
string transformedConfigServiceId = TransformServiceId . TransformServiceIdToConfigVariable ( ServiceId ) ;
327
341
328
342
if ( Environment . GetEnvironmentVariable ( serviceSpecificTransformedEnvironmentVariable ) != null )
329
343
{
330
344
Logger . GetLogger ( GetType ( ) ) . InfoFormat ( $ "ServiceURL configured from service specific environment variable: { serviceSpecificTransformedEnvironmentVariable } .") ;
331
- this . ServiceURL = Environment . GetEnvironmentVariable ( serviceSpecificTransformedEnvironmentVariable ) ;
345
+ this . ServiceURL = Environment . GetEnvironmentVariable ( serviceSpecificTransformedEnvironmentVariable ) ;
332
346
}
333
347
else if ( Environment . GetEnvironmentVariable ( EnvironmentVariables . GLOBAL_ENDPOINT_ENVIRONMENT_VARIABLE ) != null )
334
348
{
@@ -381,7 +395,7 @@ public string ServiceURL
381
395
$ "ServiceUrl was set last, ServiceUrl: { value } will be used to make the request and RegionEndpoint: { this . regionEndpoint } has been set to null.") ;
382
396
this . regionEndpoint = null ;
383
397
this . probeForRegionEndpoint = false ;
384
-
398
+
385
399
if ( ! string . IsNullOrEmpty ( value ) )
386
400
{
387
401
// If the URL passed in only has a host name make sure there is an ending "/" to avoid signature mismatch issues.
@@ -444,7 +458,7 @@ public string AuthenticationServiceName
444
458
get { return this . authServiceName ; }
445
459
set { this . authServiceName = value ; }
446
460
}
447
-
461
+
448
462
/// <summary>
449
463
/// The serviceId for the service, which is specified in the metadata in the ServiceModel.
450
464
/// The transformed value of the service ID (replace any spaces in the service ID
@@ -540,7 +554,7 @@ public long ProgressUpdateInterval
540
554
get { return progressUpdateInterval ; }
541
555
set { progressUpdateInterval = value ; }
542
556
}
543
-
557
+
544
558
545
559
/// <summary>
546
560
/// Flag on whether to resign requests on retry or not.
@@ -638,7 +652,7 @@ protected IDefaultConfiguration DefaultConfiguration
638
652
/// </summary>
639
653
public ICredentials ProxyCredentials
640
654
{
641
- get
655
+ get
642
656
{
643
657
if ( this . proxyCredentials == null &&
644
658
( ! string . IsNullOrEmpty ( AWSConfigs . ProxyConfig . Username ) ||
@@ -794,7 +808,7 @@ internal CancellationToken BuildDefaultCancellationToken()
794
808
/// </remarks>
795
809
public bool UseDualstackEndpoint
796
810
{
797
- get
811
+ get
798
812
{
799
813
if ( ! this . useDualstackEndpoint . HasValue )
800
814
{
@@ -873,10 +887,10 @@ public long RequestMinCompressionSizeBytes
873
887
874
888
return this . requestMinCompressionSizeBytes . Value ;
875
889
}
876
- set
890
+ set
877
891
{
878
892
ValidateMinCompression ( value ) ;
879
- requestMinCompressionSizeBytes = value ;
893
+ requestMinCompressionSizeBytes = value ;
880
894
}
881
895
}
882
896
@@ -902,7 +916,7 @@ public string ClientAppId
902
916
903
917
return this . clientAppId ;
904
918
}
905
- set
919
+ set
906
920
{
907
921
ValidateClientAppId ( value ) ;
908
922
this . clientAppId = value ;
@@ -1034,7 +1048,7 @@ public RequestRetryMode RetryMode
1034
1048
}
1035
1049
set { this . retryMode = value ; }
1036
1050
}
1037
-
1051
+
1038
1052
/// <summary>
1039
1053
/// Under Adaptive retry mode, this flag determines if the client should wait for
1040
1054
/// a send token to become available or don't block and fail the request immediately
@@ -1185,6 +1199,28 @@ public TelemetryProvider TelemetryProvider
1185
1199
set { this . telemetryProvider = value ; }
1186
1200
}
1187
1201
1202
+ /// <summary>
1203
+ /// Gets or sets the authentication scheme preference for this client configuration.
1204
+ /// <para>
1205
+ /// This property allows you to specify a comma-separated preference list of authentication schemes
1206
+ /// (e.g., "sigv4a,sigv4") that will be used to reprioritize the supported authentication schemes for this client.
1207
+ /// If not set, the client will use environment variables, configuration files,
1208
+ /// or fall back to the default model-based authentication scheme resolution.
1209
+ /// </para>
1210
+ /// </summary>
1211
+ public string AuthSchemePreference { get ; set ; }
1212
+
1213
+ /// <summary>
1214
+ /// Gets or sets the SigV4a signing region set for this client.
1215
+ /// <para>
1216
+ /// This property allows you to specify a comma-separated list of regions (e.g., "us-east-1,us-west-2")
1217
+ /// that will be used for SigV4a signing. The region set determines which regions the signed request is valid for.
1218
+ /// If not set, the client will use environment variables, configuration files,
1219
+ /// endpoints metadata, or fall back to the client's configured region.
1220
+ /// </para>
1221
+ /// </summary>
1222
+ public string SigV4aSigningRegionSet { get ; set ; }
1223
+
1188
1224
/// <summary>
1189
1225
/// Determines the behavior for calculating checksums for request payloads.
1190
1226
/// By default it is set to <see cref="RequestChecksumCalculation.WHEN_SUPPORTED"/>.
0 commit comments