gofr-dev / gofr-dev/gofr

LDAP Integration Helper Module

Open
#2,014 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
20.9k
Forks
1.8k
Avg merge
5d 18h
Merged PRs (30d)
39

Description

**### Problem:**
**LDAP remains widely used for enterprise authentication, especially in
internal systems. While GoFr supports token-based auth mechanisms, it lacks native
support for validating user credentials against an LDAP server**

**Goal:**
**● Provide a helper module to authenticate users using **Bind(username,
password)** logic with LDAP.
● Integrate this module into login flows — not as request middleware — since
LDAP is not token-based**

### **Implementation Plan**
**1. Investigation & scaffolding**
○ Review existing GoFr auth modules; create **_pkg/auth/ldap_**
stub.
Define interface:
type LDAPAuthenticator interface {
Bind(username, password string) error }

**2. Bind helper**
○ Use **_go-ldap/ldap/v3_** to implement Bind.
○ Handle TLS, timeouts, and configuration via GoFr’s config loader.

**3. Unit tests**
○ Mock LDAP server with ldap.NewServer() in tests.
○ Cover success, wrong credentials, network error, TLS failure.

**4. Login flow integration**
○ Add a call to pkg/auth/ldap.Bind inside
handlers/auth/login.go.
○ On success, call existing JWT/session issuance
(auth.GenerateToken).

**5. Documentation & examples**
○ Update docs/auth.md with LDAP section and sample
config.yaml.
○ Create a minimal demo under examples/ldap-login showing
environment setup and login flow.

**6. Linting & CI**
○ Ensure all code passes golangci-lint and GoFr’s CI checks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.