fix: IAM not initialized then checkKeyValid() should return 503s (#12260)

currently GetUser() returns 403 when IAM is not initialized
this can lead to applications crashing, instead return 503
so that the applications can retry and backoff.

fixes #12078
This commit is contained in:
Harshavardhana
2021-05-09 08:14:19 -07:00
committed by GitHub
parent 39d681a04a
commit 8b52d70012
4 changed files with 30 additions and 0 deletions
+12
View File
@@ -357,6 +357,12 @@ func TestIsReqAuthenticated(t *testing.T) {
t.Fatalf("unable initialize config file, %s", err)
}
newAllSubsystems()
initAllSubsystems(context.Background(), objLayer)
globalIAMSys.InitStore(objLayer)
creds, err := auth.CreateCredentials("myuser", "mypassword")
if err != nil {
t.Fatalf("unable create credential, %s", err)
@@ -442,6 +448,12 @@ func TestValidateAdminSignature(t *testing.T) {
t.Fatalf("unable initialize config file, %s", err)
}
newAllSubsystems()
initAllSubsystems(context.Background(), objLayer)
globalIAMSys.InitStore(objLayer)
creds, err := auth.CreateCredentials("admin", "mypassword")
if err != nil {
t.Fatalf("unable create credential, %s", err)