ldap

A pure-Go LDAP v3 client implementing bind, search, modify, and extended operations for directory-backed authentication and identity systems.

Library
Go
vv3.4.14
2,448stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
83/100Excellent
Development Activity80
Maintenance76
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture80
Code Quality82
Innovation62
Learning Curve65

go-ldap/ldap is the de facto standard LDAP v3 client library for Go, implementing the wire protocol described in RFC 4511 directly on top of ASN.1 BER encoding rather than wrapping a native LDAP SDK. It gives Go programs a typed, idiomatic API for the full set of directory operations: binding (simple, unauthenticated, SASL, GSSAPI, and NTLM), searching with optional paging or async streaming, adding, modifying, deleting, and renaming entries, password modification, and vendor extended operations.

Beyond the base protocol, the library covers the practical concerns of running LDAP against real directory servers: TLS and STARTTLS connection setup with custom dialers, distinguished-name parsing per RFC 4514, server-side sort and content-synchronization controls, and a Kerberos/GSSAPI bind path for integrating with Active Directory environments. Its API surface is defined as a Client interface, making it straightforward to mock in tests that exercise LDAP-backed authentication code without a live directory server.

It is widely used as the LDAP layer inside identity and access-management tooling, self-hosted SSO gateways, and infrastructure that needs to authenticate against corporate directory services such as OpenLDAP or Active Directory.

What You Get

  • A Client interface covering Bind, Search, Add, Del, Modify, ModifyDN, Compare, and Extended operations against any RFC 4511-compliant directory server
  • Multiple bind mechanisms out of the box: simple bind, unauthenticated bind, SASL/external bind, GSSAPI (Kerberos), and NTLM
  • Connection setup over plain TCP, implicit TLS, or STARTTLS, including support for a custom net.Dialer
  • Search variants for one-shot results, server-side paged search, and asynchronous streaming search via channels
  • RFC 4514-compliant distinguished name parsing and construction through the dn.go module
  • Server-side sort control, content synchronization (RFC 4533), and DirSync support for directory replication and change tracking
  • A dedicated password-modify extended operation (RFC 3062) and WhoAmI request (RFC 4532) implementation

Common Use Cases

  • Authenticating application users against a corporate Active Directory or OpenLDAP server as part of an SSO or single-sign-on gateway
  • Building internal admin tooling that reads or writes directory entries — provisioning accounts, updating group membership, rotating passwords
  • Synchronizing user and group data from an LDAP directory into an application database using paged or content-sync search
  • Implementing custom identity-provider adapters where an existing IAM product needs an LDAP backend written in Go
  • Writing infrastructure health checks or CLI utilities that query directory servers for diagnostics

Under The Hood

Architecture The library is organized around a single Conn struct in conn.go that owns the TCP/TLS socket and a background message-processing loop; each LDAP operation (bind.go, search.go, add.go, modify.go, del.go, extended.go) builds an ASN.1 BER packet via the go-asn1-ber dependency, hands it to the connection’s message dispatcher, and waits on a per-request channel for the correlated response. The public surface is defined as a Client interface in client.go, decoupling callers from the concrete Conn implementation and making LDAP-backed code straightforward to mock in tests. Request/response types live in dedicated files per operation (request.go, response.go), and DN parsing is isolated in dn.go — a design that mirrors the RFC’s own operation boundaries rather than imposing an ad hoc abstraction, so a change to how one operation is framed does not ripple into unrelated files.

Tech Stack Written in Go targeting a recent toolchain, with go-asn1-ber/asn1-ber handling BER encoding/decoding of the LDAP wire format, and optional integrations pulled in via go-ntlmssp (NTLM), sspi (Windows SSPI), and gokrb5 (Kerberos/GSSAPI) for the non-simple bind mechanisms. golang.org/x/crypto and the standard library’s crypto/tls cover TLS/STARTTLS. There is no HTTP framework or database layer involved — the module’s only real external dependency surface is protocol- and auth-mechanism-specific.

Code Quality The module ships an extensive test suite (roughly a hundred test functions across _test.go files covering bind, search, filter parsing, DN parsing, and control encoding) using testify for assertions, alongside examples_test.go files that double as runnable documentation. CI runs golangci-lint against the v3 module directory on every pull request, and a Makefile wires up gofmt, go vet, and integration tests against a local directory server via Docker/Podman. Error handling is centralized through a typed Error type in error.go that carries the numeric LDAP result code, rather than opaque string errors, which lets callers branch on protocol-level failure reasons.

What Makes It Unique Rather than wrapping a native LDAP client via cgo, the library re-implements the BER encoding and full RFC 4511 operation set natively in Go, which is what makes it viable in cross-compiled, statically linked binaries with no system LDAP dependency. Its bind path is unusually complete for a community library — simple, SASL, GSSAPI, and NTLM are all first-class — which is why it has become the standard choice for Go services that need to authenticate against Active Directory specifically, not just generic OpenLDAP.

Used by 17 apps in this directory

Go
86%
Apache 2.0

Authelia

Security · Authentication

28,742

OpenID Certified SSO and MFA portal for securing self-hosted web applications behind reverse proxies.

View details
91
Repo Health
81
Technical
77
Dependency
Built with
Go86%
TypeScript12%
Updated today
Python
55%
Other

authentik

Authentication · Security

25,245

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
67
Dependency
Built with
Python55%
TypeScript34%
Updated today
Go
55%
Apache 2.0

Authgear

Authentication

2,014

Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.

View details
88
Repo Health
81
Technical
69
Dependency
Built with
Go55%
HTML25%
TypeScript17%
Updated 4 days ago
Go
52%
MIT

Bytebase

Devops

14,449

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

View details
91
Repo Health
73
Technical
69
Dependency
Built with
Go52%
TypeScript39%
Updated yesterday
Go
51%
AGPL 3.0

Filestash

File Storage

14,560

A self-hosted file management platform that unifies access to S3, SFTP, SMB, FTP, WebDAV, NFS, Git, SharePoint, and 20+ other storage backends through a single extensible web interface.

View details
79
Repo Health
67
Technical
66
Dependency
Built with
Go51%
JavaScript35%
Updated 3 days ago
Go
83%
MIT

Gitea

Devops · Developer Tools · Project Management

57,677

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
Go83%
Updated today
Go
68%
MIT

Gogs

Developer Tools

47,783

The painless self-hosted Git service that runs on anything from a Raspberry Pi to a $5 cloud droplet, delivering GitHub-like workflows as a single Go binary.

View details
96
Repo Health
79
Technical
72
Dependency
Built with
Go68%
Go Template16%
TypeScript10%
Updated 4 days ago
TypeScript
49%
AGPL 3.0

Grafana

Monitoring · Analytics

76,498

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
65
Dependency
Built with
TypeScript49%
Go45%
Updated today
Go
99%
AGPL 3.0

MinIO

File Storage

61,375

High-performance, S3-compatible object storage built for AI/ML and analytics workloads — run it anywhere from a laptop to a petabyte-scale cluster.

View details
60
Repo Health
85
Technical
66
Dependency
Built with
Go99%
Updated 4 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search