mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
api: postPolicy cleanup. Simplify the code and re-use. (#3890)
This change is cleanup of the postPolicyHandler code primarily to address the flow and also converting certain critical parts into self contained functions.
This commit is contained in:
+4
-4
@@ -64,14 +64,14 @@ var resourceList = []string{
|
||||
"website",
|
||||
}
|
||||
|
||||
func doesPolicySignatureV2Match(formValues map[string]string) APIErrorCode {
|
||||
func doesPolicySignatureV2Match(formValues http.Header) APIErrorCode {
|
||||
cred := serverConfig.GetCredential()
|
||||
accessKey := formValues["Awsaccesskeyid"]
|
||||
accessKey := formValues.Get("AWSAccessKeyId")
|
||||
if accessKey != cred.AccessKey {
|
||||
return ErrInvalidAccessKeyID
|
||||
}
|
||||
signature := formValues["Signature"]
|
||||
policy := formValues["Policy"]
|
||||
policy := formValues.Get("Policy")
|
||||
signature := formValues.Get("Signature")
|
||||
if signature != calculateSignatureV2(policy, cred.SecretKey) {
|
||||
return ErrSignatureDoesNotMatch
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user