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.
2
2
3
3
using System . Text . Json . Serialization ;
4
4
@@ -13,6 +13,7 @@ public enum AuthTypes
13
13
{
14
14
Unknown = - 1 ,
15
15
AccessKey ,
16
+ CredentialChain ,
16
17
}
17
18
18
19
public AuthTypes Auth { get ; set ; } = AuthTypes . Unknown ;
@@ -45,14 +46,17 @@ public void Validate()
45
46
throw new ConfigurationException ( $ "Authentication type '{ this . Auth } ' undefined or not supported") ;
46
47
}
47
48
48
- if ( string . IsNullOrWhiteSpace ( this . AccessKey ) )
49
+ if ( this . Auth == AuthTypes . AccessKey )
49
50
{
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
+ }
52
55
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
+ }
56
60
}
57
61
58
62
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.
2
2
3
3
using System ;
4
4
using System . Collections . Generic ;
@@ -43,6 +43,15 @@ public AWSS3Storage(
43
43
) ;
44
44
break ;
45
45
}
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
+ }
46
55
47
56
default :
48
57
this . _log . LogCritical ( "Authentication type '{0}' undefined or not supported" , config . Auth ) ;
Original file line number Diff line number Diff line change 242
242
"HttpClientName" : " "
243
243
},
244
244
"AWSS3" : {
245
+ // "AccessKey" or "CredentialChain". For other options see <AWSS3Config>.
245
246
"Auth" : " AccessKey" ,
246
247
// AccessKey ID, required when using AccessKey auth
247
248
// 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