Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hghaf099 committed May 2, 2022
1 parent 7b5c656 commit b2a7a31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions vault/external_tests/mfa/login_mfa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -233,7 +233,7 @@ func TestLoginMFA_ListAllMFAConfigsGlobally(t *testing.T) {
mountAccessor := auths["userpass/"].Accessor

mfaConfigs := []struct {
methodName string
methodType string
configData map[string]interface{}
}{
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion vault/login_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit b2a7a31

Please sign in to comment.