mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 22:16:15 +03:00
signature: Use a layered approach for signature verification.
Signature calculation has now moved out from being a package to top-level as a layered mechanism. In case of payload calculation with body, go-routines are initiated to simultaneously write and calculate shasum. Errors are sent over the writer so that the lower layer removes the temporary files properly.
This commit is contained in:
-10
@@ -29,7 +29,6 @@ import (
|
||||
"github.com/minio/minio-go"
|
||||
"github.com/minio/minio/pkg/fs"
|
||||
"github.com/minio/minio/pkg/probe"
|
||||
"github.com/minio/minio/pkg/s3/signature4"
|
||||
"github.com/minio/miniobrowser"
|
||||
)
|
||||
|
||||
@@ -37,8 +36,6 @@ import (
|
||||
type storageAPI struct {
|
||||
// Filesystem instance.
|
||||
Filesystem fs.Filesystem
|
||||
// Signature instance.
|
||||
Signature *signature4.Sign
|
||||
}
|
||||
|
||||
// webAPI container for Web API.
|
||||
@@ -163,19 +160,12 @@ func configureServerHandler(filesystem fs.Filesystem) http.Handler {
|
||||
// Access credentials.
|
||||
cred := serverConfig.GetCredential()
|
||||
|
||||
// Server region.
|
||||
region := serverConfig.GetRegion()
|
||||
|
||||
// Server addr.
|
||||
addr := serverConfig.GetAddr()
|
||||
|
||||
sign, err := signature4.New(cred.AccessKeyID, cred.SecretAccessKey, region)
|
||||
fatalIf(err.Trace(cred.AccessKeyID, cred.SecretAccessKey, region), "Initializing signature version '4' failed.", nil)
|
||||
|
||||
// Initialize API.
|
||||
api := storageAPI{
|
||||
Filesystem: filesystem,
|
||||
Signature: sign,
|
||||
}
|
||||
|
||||
// Split host port.
|
||||
|
||||
Reference in New Issue
Block a user