@@ -114,6 +114,16 @@ public class InternalConfiguration
114
114
/// Determines the behavior for validating checksums on response payloads.
115
115
/// </summary>
116
116
public ResponseChecksumValidation ? ResponseChecksumValidation { get ; set ; }
117
+
118
+ /// <summary>
119
+ /// Comma-separated list of authentication scheme preferences (e.g., "sigv4a,sigv4").
120
+ /// </summary>
121
+ public string AuthSchemePreference { get ; set ; }
122
+
123
+ /// <summary>
124
+ /// Comma-separated list of regions for SigV4a signing (e.g., "us-east-1,us-west-2").
125
+ /// </summary>
126
+ public string SigV4aSigningRegionSet { get ; set ; }
117
127
}
118
128
119
129
#if BCL || NETSTANDARD
@@ -140,6 +150,8 @@ public class EnvironmentVariableInternalConfiguration : InternalConfiguration
140
150
public const string ENVIRONMENT_VARAIBLE_AWS_ACCOUNT_ID_ENDPOINT_MODE = "AWS_ACCOUNT_ID_ENDPOINT_MODE" ;
141
151
public const string ENVIRONMENT_VARIABLE_AWS_REQUEST_CHECKSUM_CALCULATION = "AWS_REQUEST_CHECKSUM_CALCULATION" ;
142
152
public const string ENVIRONMENT_VARIABLE_AWS_RESPONSE_CHECKSUM_VALIDATION = "AWS_RESPONSE_CHECKSUM_VALIDATION" ;
153
+ public const string ENVIRONMENT_VARIABLE_AWS_AUTH_SCHEME_PREFERENCE = "AWS_AUTH_SCHEME_PREFERENCE" ;
154
+ public const string ENVIRONMENT_VARIABLE_AWS_SIGV4A_SIGNING_REGION_SET = "AWS_SIGV4A_SIGNING_REGION_SET" ;
143
155
public const int AWS_SDK_UA_APP_ID_MAX_LENGTH = 50 ;
144
156
145
157
/// <summary>
@@ -165,6 +177,10 @@ public EnvironmentVariableInternalConfiguration()
165
177
RequestChecksumCalculation = GetEnvironmentVariable < RequestChecksumCalculation > ( ENVIRONMENT_VARIABLE_AWS_REQUEST_CHECKSUM_CALCULATION ) ;
166
178
ResponseChecksumValidation = GetEnvironmentVariable < ResponseChecksumValidation > ( ENVIRONMENT_VARIABLE_AWS_RESPONSE_CHECKSUM_VALIDATION ) ;
167
179
ClientAppId = GetClientAppIdEnvironmentVariable ( ) ;
180
+ TryGetEnvironmentVariable ( ENVIRONMENT_VARIABLE_AWS_AUTH_SCHEME_PREFERENCE , out var authPref ) ;
181
+ AuthSchemePreference = authPref ;
182
+ TryGetEnvironmentVariable ( ENVIRONMENT_VARIABLE_AWS_SIGV4A_SIGNING_REGION_SET , out var regionSet ) ;
183
+ SigV4aSigningRegionSet = regionSet ;
168
184
}
169
185
170
186
private bool GetEnvironmentVariable ( string name , bool defaultValue )
@@ -340,6 +356,16 @@ private void Setup(ICredentialProfileSource source, string profileName)
340
356
AccountIdEndpointMode = profile . AccountIdEndpointMode ;
341
357
RequestChecksumCalculation = profile . RequestChecksumCalculation ;
342
358
ResponseChecksumValidation = profile . ResponseChecksumValidation ;
359
+
360
+ // Auth scheme properties are stored in the Properties dictionary
361
+ if ( profile . Properties . TryGetValue ( "auth_scheme_preference" , out string authSchemePreference ) )
362
+ {
363
+ AuthSchemePreference = string . IsNullOrWhiteSpace ( authSchemePreference ) ? null : authSchemePreference . Trim ( ) ;
364
+ }
365
+ if ( profile . Properties . TryGetValue ( "sigv4a_signing_region_set" , out string sigv4aRegionSet ) )
366
+ {
367
+ SigV4aSigningRegionSet = string . IsNullOrWhiteSpace ( sigv4aRegionSet ) ? null : sigv4aRegionSet . Trim ( ) ;
368
+ }
343
369
}
344
370
else
345
371
{
@@ -365,6 +391,8 @@ private void Setup(ICredentialProfileSource source, string profileName)
365
391
new KeyValuePair < string , object > ( "account_id_endpoint_mode" , profile . AccountIdEndpointMode ) ,
366
392
new KeyValuePair < string , object > ( "request_checksum_calculation" , profile . RequestChecksumCalculation ) ,
367
393
new KeyValuePair < string , object > ( "response_checksum_validation" , profile . ResponseChecksumValidation ) ,
394
+ new KeyValuePair < string , object > ( "auth_scheme_preference" , AuthSchemePreference ) ,
395
+ new KeyValuePair < string , object > ( "sigv4a_signing_region_set" , SigV4aSigningRegionSet ) ,
368
396
} ;
369
397
370
398
foreach ( var item in items )
@@ -436,6 +464,8 @@ public static void Reset()
436
464
_cachedConfiguration . AccountIdEndpointMode = SeekValue ( standardGenerators , ( c ) => c . AccountIdEndpointMode ) ;
437
465
_cachedConfiguration . RequestChecksumCalculation = SeekValue ( standardGenerators , ( c ) => c . RequestChecksumCalculation ) ;
438
466
_cachedConfiguration . ResponseChecksumValidation = SeekValue ( standardGenerators , ( c ) => c . ResponseChecksumValidation ) ;
467
+ _cachedConfiguration . AuthSchemePreference = SeekString ( standardGenerators , ( c ) => c . AuthSchemePreference , defaultValue : null ) ;
468
+ _cachedConfiguration . SigV4aSigningRegionSet = SeekString ( standardGenerators , ( c ) => c . SigV4aSigningRegionSet , defaultValue : null ) ;
439
469
}
440
470
441
471
private static T ? SeekValue < T > ( List < ConfigGenerator > generators , Func < InternalConfiguration , T ? > getValue ) where T : struct
@@ -634,5 +664,27 @@ public static ResponseChecksumValidation? ResponseChecksumValidation
634
664
return _cachedConfiguration . ResponseChecksumValidation ;
635
665
}
636
666
}
667
+
668
+ /// <summary>
669
+ /// Gets the authentication scheme preference from environment or config files.
670
+ /// </summary>
671
+ public static string AuthSchemePreference
672
+ {
673
+ get
674
+ {
675
+ return _cachedConfiguration . AuthSchemePreference ;
676
+ }
677
+ }
678
+
679
+ /// <summary>
680
+ /// Gets the SigV4a signing region set from environment or config files.
681
+ /// </summary>
682
+ public static string SigV4aSigningRegionSet
683
+ {
684
+ get
685
+ {
686
+ return _cachedConfiguration . SigV4aSigningRegionSet ;
687
+ }
688
+ }
637
689
}
638
690
}
0 commit comments