diff options
author | Harshavardhana <harsha@minio.io> | 2017-05-30 16:12:24 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-05-30 16:12:24 -0700 |
commit | f520aa1f4d18a65919c22240a4d0352022d6ca1b (patch) | |
tree | 558e3b39bbc0e8c7ee9dccb51ca912789786e080 /api4 | |
parent | d409c7c1c6a21de203c471134419726e1c7dcb12 (diff) | |
download | chat-f520aa1f4d18a65919c22240a4d0352022d6ca1b.tar.gz chat-f520aa1f4d18a65919c22240a4d0352022d6ca1b.tar.bz2 chat-f520aa1f4d18a65919c22240a4d0352022d6ca1b.zip |
Support AWS Signature V2 for Mattermost for S3 storage. (#6462)
Certain S3 compatible servers only use Legacy Signature (AWS
Signature V2), current code only supports signature v4.
This PR adds facility to click a button on the UI to enable
legacy signature with S3 compatible servers.
Diffstat (limited to 'api4')
-rw-r--r-- | api4/apitestlib.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/api4/apitestlib.go b/api4/apitestlib.go index 7075488cb..ef200bf2f 100644 --- a/api4/apitestlib.go +++ b/api4/apitestlib.go @@ -626,13 +626,21 @@ func readTestFile(name string) ([]byte, error) { } } +func s3New(endpoint, accessKey, secretKey string, secure bool, signV2 bool) (*s3.Client, error) { + if signV2 { + return s3.NewV2(endpoint, accessKey, secretKey, secure) + } + return s3.NewV4(endpoint, accessKey, secretKey, secure) +} + func cleanupTestFile(info *model.FileInfo) error { if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 { endpoint := utils.Cfg.FileSettings.AmazonS3Endpoint accessKey := utils.Cfg.FileSettings.AmazonS3AccessKeyId secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey secure := *utils.Cfg.FileSettings.AmazonS3SSL - s3Clnt, err := s3.New(endpoint, accessKey, secretKey, secure) + signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2 + s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2) if err != nil { return err } |