return meaningful error for disabled users (#13968)

fixes #13958
This commit is contained in:
Harshavardhana
2021-12-22 11:40:21 -08:00
committed by GitHub
parent 41f75e6d1b
commit 1cf726348f
3 changed files with 291 additions and 279 deletions
+5
View File
@@ -154,6 +154,11 @@ func checkKeyValid(r *http.Request, accessKey string) (auth.Credentials, bool, A
// Check if the access key is part of users credentials.
ucred, ok := globalIAMSys.GetUser(r.Context(), accessKey)
if !ok {
// Credentials will be invalid but and disabled
// return a different error in such a scenario.
if ucred.Status == auth.AccountOff {
return cred, false, ErrAccessKeyDisabled
}
return cred, false, ErrInvalidAccessKeyID
}
cred = ucred