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 (
|
|
|
|
"crypto/tls"
|
2019-11-20 19:26:13 +00:00
|
|
|
"time"
|
2018-05-10 21:12:42 +00:00
|
|
|
|
2019-11-08 16:18:36 +00:00
|
|
|
"github.com/go-ldap/ldap/v3"
|
2018-05-10 21:12:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Connection provides the functionality of an LDAP connection,
|
|
|
|
// but through an interface.
|
|
|
|
type Connection interface {
|
|
|
|
Bind(username, password string) error
|
|
|
|
Close()
|
2021-01-20 23:59:29 +00:00
|
|
|
Add(addRequest *ldap.AddRequest) error
|
2018-05-10 21:12:42 +00:00
|
|
|
Modify(modifyRequest *ldap.ModifyRequest) error
|
2021-01-20 23:59:29 +00:00
|
|
|
Del(delRequest *ldap.DelRequest) error
|
2018-05-10 21:12:42 +00:00
|
|
|
Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
|
|
|
|
StartTLS(config *tls.Config) error
|
2019-11-20 19:26:13 +00:00
|
|
|
SetTimeout(timeout time.Duration)
|
2018-05-10 21:12:42 +00:00
|
|
|
UnauthenticatedBind(username string) error
|
|
|
|
}
|
2022-10-26 19:05:53 +00:00
|
|
|
|
|
|
|
type PagingConnection interface {
|
|
|
|
Connection
|
|
|
|
SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
|
|
|
|
}
|