vault/sdk/helper/ldaputil/connection.go
John-Michael Faircloth 7d575bf979
auth/ldap: fix login errors (#26200)
* auth/ldap: fix login errors

This fixes 2 ldap auth login errors

* Missing entity alias attribute value
  * Vault relies on case insensitive user attribute keys for mapping user
    attributes to entity alias metadata. This sets the appropriate
    configs in the cap library.

* ldap group search anonymous bind regression
  * Anonymous group searches can be rejected by some LDAP servers if
    they contain a userDN. This sets the configs in the cap library to
    specify unauthenticated binds for anonymous group searches should
    exclude a DN.

Closes https://github.com/hashicorp/vault/issues/26171
Closes https://github.com/hashicorp/vault/issues/26183

* changelog

* go mod tidy

* go get cap/ldap@latest and go mod tidy
2024-03-28 13:45:43 -05:00

31 lines
794 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package ldaputil
import (
"crypto/tls"
"time"
"github.com/go-ldap/ldap/v3"
)
// Connection provides the functionality of an LDAP connection,
// but through an interface.
type Connection interface {
Bind(username, password string) error
Close() error
Add(addRequest *ldap.AddRequest) error
Modify(modifyRequest *ldap.ModifyRequest) error
Del(delRequest *ldap.DelRequest) error
Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
StartTLS(config *tls.Config) error
SetTimeout(timeout time.Duration)
UnauthenticatedBind(username string) error
}
type PagingConnection interface {
Connection
SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
}