loadUser() if not able to load() credential return error (#19931)

This commit is contained in:
Harshavardhana
2024-06-13 15:26:38 -07:00
committed by GitHub
parent 62e6dc950d
commit ba39ed9af7
9 changed files with 71 additions and 29 deletions

View File

@@ -152,11 +152,14 @@ func checkKeyValid(r *http.Request, accessKey string) (auth.Credentials, bool, A
// Check if server has initialized, then only proceed
// to check for IAM users otherwise its okay for clients
// to retry with 503 errors when server is coming up.
return auth.Credentials{}, false, ErrServerNotInitialized
return auth.Credentials{}, false, ErrIAMNotInitialized
}
// Check if the access key is part of users credentials.
u, ok := globalIAMSys.GetUser(r.Context(), accessKey)
u, ok, err := globalIAMSys.CheckKey(r.Context(), accessKey)
if err != nil {
return auth.Credentials{}, false, ErrIAMNotInitialized
}
if !ok {
// Credentials could be valid but disabled - return a different
// error in such a scenario.