github.com/hashicorp/vault/sdk@v0.11.0/helper/ldaputil/connection.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package ldaputil
     5  
     6  import (
     7  	"crypto/tls"
     8  	"time"
     9  
    10  	"github.com/go-ldap/ldap/v3"
    11  )
    12  
    13  // Connection provides the functionality of an LDAP connection,
    14  // but through an interface.
    15  type Connection interface {
    16  	Bind(username, password string) error
    17  	Close()
    18  	Add(addRequest *ldap.AddRequest) error
    19  	Modify(modifyRequest *ldap.ModifyRequest) error
    20  	Del(delRequest *ldap.DelRequest) error
    21  	Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
    22  	StartTLS(config *tls.Config) error
    23  	SetTimeout(timeout time.Duration)
    24  	UnauthenticatedBind(username string) error
    25  }
    26  
    27  type PagingConnection interface {
    28  	Connection
    29  	SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
    30  }