File tree Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1- // Copyright (c) Microsoft. All rights reserved.
1+ // Copyright (c) Microsoft. All rights reserved.
22
33using System . Text . Json . Serialization ;
44
@@ -13,6 +13,7 @@ public enum AuthTypes
1313 {
1414 Unknown = - 1 ,
1515 AccessKey ,
16+ CredentialChain ,
1617 }
1718
1819 public AuthTypes Auth { get ; set ; } = AuthTypes . Unknown ;
@@ -45,14 +46,17 @@ public void Validate()
4546 throw new ConfigurationException ( $ "Authentication type '{ this . Auth } ' undefined or not supported") ;
4647 }
4748
48- if ( string . IsNullOrWhiteSpace ( this . AccessKey ) )
49+ if ( this . Auth == AuthTypes . AccessKey )
4950 {
50- throw new ConfigurationException ( "S3 Access Key is undefined" ) ;
51- }
51+ if ( string . IsNullOrWhiteSpace ( this . AccessKey ) )
52+ {
53+ throw new ConfigurationException ( "S3 Access Key is undefined" ) ;
54+ }
5255
53- if ( string . IsNullOrWhiteSpace ( this . SecretAccessKey ) )
54- {
55- throw new ConfigurationException ( "S3 Secret Key Access undefined" ) ;
56+ if ( string . IsNullOrWhiteSpace ( this . SecretAccessKey ) )
57+ {
58+ throw new ConfigurationException ( "S3 Secret Key Access undefined" ) ;
59+ }
5660 }
5761
5862 if ( string . IsNullOrWhiteSpace ( this . BucketName ) )
Original file line number Diff line number Diff line change 1- // Copyright (c) Microsoft. All rights reserved.
1+ // Copyright (c) Microsoft. All rights reserved.
22
33using System ;
44using System . Collections . Generic ;
@@ -43,6 +43,15 @@ public AWSS3Storage(
4343 ) ;
4444 break ;
4545 }
46+ case AWSS3Config . AuthTypes . CredentialChain :
47+ {
48+ this . _client = new AmazonS3Client ( new AmazonS3Config
49+ {
50+ ServiceURL = config . Endpoint ,
51+ LogResponse = true
52+ } ) ;
53+ break ;
54+ }
4655
4756 default :
4857 this . _log . LogCritical ( "Authentication type '{0}' undefined or not supported" , config . Auth ) ;
Original file line number Diff line number Diff line change 242242 "HttpClientName" : " "
243243 },
244244 "AWSS3" : {
245+ // "AccessKey" or "CredentialChain". For other options see <AWSS3Config>.
245246 "Auth" : " AccessKey" ,
246247 // AccessKey ID, required when using AccessKey auth
247248 // Note: you can use an env var 'KernelMemory__Services__AWSS3__AccessKey' to set this
You can’t perform that action at this time.
0 commit comments