Correcting response on invalid login attempt (#2216)

Verifying detailed message error from bad login in SSO Test
This commit is contained in:
Cesar Celis Hernandez
2022-08-01 19:12:39 -04:00
committed by GitHub
parent ea0cac2a92
commit 16fd5470db
2 changed files with 20 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ package restapi
import (
"context"
"errors"
"strings"
"github.com/go-openapi/swag"
"github.com/minio/console/models"
@@ -69,6 +70,7 @@ var (
ErrDeletingEncryptionConfig = errors.New("error disabling tenant encryption")
ErrEncryptionConfigNotFound = errors.New("encryption configuration not found")
ErrPolicyNotFound = errors.New("policy does not exist")
ErrLoginNotAllowed = errors.New("login not allowed")
)
// ErrorWithContext :
@@ -93,6 +95,10 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
errorCode = 401
errorMessage = ErrInvalidLogin.Error()
}
if strings.Contains(err1.Error(), ErrLoginNotAllowed.Error()) {
errorCode = 400
errorMessage = ErrLoginNotAllowed.Error()
}
// console invalid erasure coding value
if errors.Is(err1, ErrInvalidErasureCodingValue) {
errorCode = 400