feature (boundary dev): add support for dev ldap auth method (#3192)

This commit is contained in:
Jim authored and GitHub committed 2023-04-28 11:35:54 -04:00
1 parent 9a050ec15a
commit 667ea285be
19 files changed
+345 -14

No files matched your search

@@ -5,11 +5,16 @@ package controller
import (
"bytes"
"context"
"io"
"os"
"testing"
"github.com/hashicorp/boundary/globals"
"github.com/hashicorp/boundary/internal/auth/ldap"
"github.com/hashicorp/boundary/internal/db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_TestController(t *testing.T) {
@@ -65,4 +70,19 @@ func Test_TestController(t *testing.T) {
defer tc.Shutdown()
}))
})
t.Run("set-default-ldap-auth-method-id", func(t *testing.T) {
t.Parallel()
assert, require := assert.New(t), require.New(t)
testCtx := context.Background()
testLdapAuthMethodId := globals.LdapAuthMethodPrefix + "_0123456789"
tc := NewTestController(t, &TestControllerOpts{DefaultLdapAuthMethodId: testLdapAuthMethodId})
defer tc.Shutdown()
testRw := db.New(tc.DbConn())
testLdapRepo, err := ldap.NewRepository(testCtx, testRw, testRw, tc.c.kms)
require.NoError(err)
got, err := testLdapRepo.LookupAuthMethod(testCtx, testLdapAuthMethodId)
require.NoError(err)
assert.Equal(testLdapAuthMethodId, got.GetPublicId())
})
}