[PR #18212] Add LDAP Authentication Support #28857

Closed
opened 2026-02-21 20:44:15 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/18212

State: closed
Merged: No


Add LDAP Authentication Support

Summary

  • Feature: Add LDAP authentication login support
  • Context: Enterprise environments usually use LDAP/AD as a unified identity authentication system. This PR adds LDAP integration capabilities to Dify
  • Dependencies:
  • Requires Python's flask-ldap3-login, ldap3 packages (added to poetry)
  • Requires a properly configured LDAP server

Changes

  1. Backend:
  • Added LDAP authentication module configuration
  • Added LDAP user attribute mapping function
  • Implemented LDAP user cache mechanism

Checklist

  • Added LDAP configuration verification logic
  • Passed backend test
  • Compatible with the original database migration

Configuration example

# LDAP basic configuration
LDAP_ENABLED=false
AUTH_LDAP_SERVER_URI=ldap://127.0.0.1:389
AUTH_LDAP_BIND_DN=CN=ArcherMaster,CN=Users,DC=dify,DC=com
AUTH_LDAP_BIND_PASSWORD=dify@123456
AUTH_LDAP_SEARCH_BASE_DN=OU=dify Technology Co., Ltd.,DC=dify,DC=com
AUTH_LDAP_USER_FILTER=(mail=%(user)s)
AUTH_LDAP_USER_ATTR_MAP={"first_name": "uid", "last_name": "cn", "email": "mail"}
CACHE_LDAP_USER_KEY=LDAP_USER_INFO_DATA
CACHE_LDAP_USER_EX=86400
LDAP_DEFAULT_ROLE=normal
LDAP_CONN_TIMEOUT=10
LDAP_POOL_SIZE=10
**Original Pull Request:** https://github.com/langgenius/dify/pull/18212 **State:** closed **Merged:** No --- # Add LDAP Authentication Support ## Summary - **Feature**: Add LDAP authentication login support - **Context**: Enterprise environments usually use LDAP/AD as a unified identity authentication system. This PR adds LDAP integration capabilities to Dify - **Dependencies**: - Requires Python's `flask-ldap3-login, ldap3` packages (added to poetry) - Requires a properly configured LDAP server ## Changes 1. Backend: - Added LDAP authentication module configuration - Added LDAP user attribute mapping function - Implemented LDAP user cache mechanism ## Checklist - [x] Added LDAP configuration verification logic - [x] Passed backend test - [x] Compatible with the original database migration ## Configuration example ```env # LDAP basic configuration LDAP_ENABLED=false AUTH_LDAP_SERVER_URI=ldap://127.0.0.1:389 AUTH_LDAP_BIND_DN=CN=ArcherMaster,CN=Users,DC=dify,DC=com AUTH_LDAP_BIND_PASSWORD=dify@123456 AUTH_LDAP_SEARCH_BASE_DN=OU=dify Technology Co., Ltd.,DC=dify,DC=com AUTH_LDAP_USER_FILTER=(mail=%(user)s) AUTH_LDAP_USER_ATTR_MAP={"first_name": "uid", "last_name": "cn", "email": "mail"} CACHE_LDAP_USER_KEY=LDAP_USER_INFO_DATA CACHE_LDAP_USER_EX=86400 LDAP_DEFAULT_ROLE=normal LDAP_CONN_TIMEOUT=10 LDAP_POOL_SIZE=10
yindo added the pull-request label 2026-02-21 20:44:15 -05:00
yindo closed this issue 2026-02-21 20:44:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#28857