2023-03-15 16:00:52 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2018-05-10 21:12:42 +00:00
|
|
|
package ldaputil
|
|
|
|
|
|
|
|
import (
|
2019-11-08 16:18:36 +00:00
|
|
|
"github.com/go-ldap/ldap/v3"
|
2018-05-10 21:12:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func NewLDAP() LDAP {
|
|
|
|
return &ldapIfc{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// LDAP provides ldap functionality, but through an interface
|
|
|
|
// rather than statically. This allows faking it for tests.
|
|
|
|
type LDAP interface {
|
2023-04-17 20:34:10 +00:00
|
|
|
DialURL(addr string, opts ...ldap.DialOpt) (Connection, error)
|
2018-05-10 21:12:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ldapIfc struct{}
|
|
|
|
|
2023-04-17 20:34:10 +00:00
|
|
|
func (l *ldapIfc) DialURL(addr string, opts ...ldap.DialOpt) (Connection, error) {
|
|
|
|
return ldap.DialURL(addr, opts...)
|
2018-05-10 21:12:42 +00:00
|
|
|
}
|