diff --git a/vault/external_tests/mfa/login_mfa_test.go b/vault/external_tests/mfa/login_mfa_test.go index 178f64508bf8..427818640277 100644 --- a/vault/external_tests/mfa/login_mfa_test.go +++ b/vault/external_tests/mfa/login_mfa_test.go @@ -45,7 +45,7 @@ func TestLoginMFA_Method_CRUD(t *testing.T) { testCases := []struct { methodName string - invalidName string + invalidType string configData map[string]interface{} keyToUpdate string valueToUpdate string @@ -171,7 +171,7 @@ func TestLoginMFA_Method_CRUD(t *testing.T) { } // read the id on another MFA type endpoint should fail - invalidPath := fmt.Sprintf("identity/mfa/method/%s/%s", tc.invalidName, methodId) + invalidPath := fmt.Sprintf("identity/mfa/method/%s/%s", tc.invalidType, methodId) resp, err = client.Logical().Read(invalidPath) if err == nil { t.Fatal(err) @@ -233,7 +233,7 @@ func TestLoginMFA_ListAllMFAConfigsGlobally(t *testing.T) { mountAccessor := auths["userpass/"].Accessor mfaConfigs := []struct { - methodName string + methodType string configData map[string]interface{} }{ { @@ -279,7 +279,7 @@ func TestLoginMFA_ListAllMFAConfigsGlobally(t *testing.T) { var methodIDs []interface{} for _, method := range mfaConfigs { // create a new method config - myPath := fmt.Sprintf("identity/mfa/method/%s", method.methodName) + myPath := fmt.Sprintf("identity/mfa/method/%s", method.methodType) resp, err := client.Logical().Write(myPath, method.configData) if err != nil { t.Fatal(err) diff --git a/vault/login_mfa.go b/vault/login_mfa.go index 1ad3c5fa0a80..71aa920f2de4 100644 --- a/vault/login_mfa.go +++ b/vault/login_mfa.go @@ -230,7 +230,7 @@ func (i *IdentityStore) handleMFAMethodReadCommon(ctx context.Context, req *logi } if methodType != "" && respData["type"] != methodType { - return logical.ErrorResponse("invalid method type %s, expected %s", respData["type"], methodType), nil + return logical.ErrorResponse("failed to find the method ID under MFA type %s. Method ID belongs to %s MFA type", methodType, respData["type"]), nil } return &logical.Response{