a47758865c
Closes https://github.com/hashicorp/vault/pull/7780 Changes to other parts of Vault have to come piece by piece, that's next.
29 lines
647 B
Go
29 lines
647 B
Go
package ldaputil
|
|
|
|
import (
|
|
"crypto/tls"
|
|
|
|
"github.com/go-ldap/ldap/v3"
|
|
)
|
|
|
|
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 {
|
|
Dial(network, addr string) (Connection, error)
|
|
DialTLS(network, addr string, config *tls.Config) (Connection, error)
|
|
}
|
|
|
|
type ldapIfc struct{}
|
|
|
|
func (l *ldapIfc) Dial(network, addr string) (Connection, error) {
|
|
return ldap.Dial(network, addr)
|
|
}
|
|
|
|
func (l *ldapIfc) DialTLS(network, addr string, config *tls.Config) (Connection, error) {
|
|
return ldap.DialTLS(network, addr, config)
|
|
}
|