mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Parse and return proper errors with x-amz-security-token (#6766)
This PR also simplifies the token and access key validation across our signature handling.
This commit is contained in:
committed by
Nitish Tiwari
parent
88959ce600
commit
bf414068a3
@@ -91,17 +91,9 @@ func calculateSeedSignature(r *http.Request) (cred auth.Credentials, signature s
|
||||
return cred, "", "", time.Time{}, errCode
|
||||
}
|
||||
|
||||
cred = globalServerConfig.GetCredential()
|
||||
// Verify if the access key id matches.
|
||||
if signV4Values.Credential.accessKey != cred.AccessKey {
|
||||
if globalIAMSys == nil {
|
||||
return cred, "", "", time.Time{}, ErrInvalidAccessKeyID
|
||||
}
|
||||
var ok bool
|
||||
cred, ok = globalIAMSys.GetUser(signV4Values.Credential.accessKey)
|
||||
if !ok {
|
||||
return cred, "", "", time.Time{}, ErrInvalidAccessKeyID
|
||||
}
|
||||
cred, _, errCode = checkKeyValid(signV4Values.Credential.accessKey)
|
||||
if errCode != ErrNone {
|
||||
return cred, "", "", time.Time{}, errCode
|
||||
}
|
||||
|
||||
// Verify if region is valid.
|
||||
@@ -114,6 +106,7 @@ func calculateSeedSignature(r *http.Request) (cred auth.Credentials, signature s
|
||||
return cred, "", "", time.Time{}, ErrMissingDateHeader
|
||||
}
|
||||
}
|
||||
|
||||
// Parse date header.
|
||||
var err error
|
||||
date, err = time.Parse(iso8601Format, dateStr)
|
||||
|
||||
Reference in New Issue
Block a user