mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05: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:
@@ -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