[PR #1756] [MERGED] Implement native LDAP authentication #4518

Closed
opened 2026-03-15 01:49:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ArchiveBox/ArchiveBox/pull/1756
Author: @pirate
Created: 1/6/2026
Status: Merged
Merged: 1/6/2026
Merged by: @pirate

Base: devHead: claude/issue-1664-20260105-2125


📝 Commits (1)

  • c2bb4b2 Implement native LDAP authentication support

📊 Changes

7 files changed (+415 additions, -10 deletions)

View changed files

📝 archivebox/config/__init__.py (+2 -0)
archivebox/config/ldap.py (+56 -0)
📝 archivebox/core/settings.py (+60 -10)
archivebox/ldap/__init__.py (+17 -0)
archivebox/ldap/apps.py (+13 -0)
archivebox/ldap/auth.py (+49 -0)
archivebox/tests/test_auth_ldap.py (+218 -0)

📄 Description

Summary

Implements native LDAP authentication support for ArchiveBox.

Changes

  • Create archivebox/config/ldap.py with LDAPConfig class
  • Create archivebox/ldap/ Django app with custom auth backend
  • Update core/settings.py to conditionally load LDAP when enabled
  • Add LDAP_CREATE_SUPERUSER support to auto-grant superuser privileges
  • Add comprehensive tests in test_auth_ldap.py (no mocks, no skips)
  • LDAP only activates if django-auth-ldap is installed and LDAP_ENABLED=True
  • Helpful error messages when LDAP libraries are missing or config is incomplete

Implementation Approach

  • Native integration (not a plugin)
  • Conditional loading based on libraries + config
  • Separate Django app for LDAP logic
  • Clean if statements in settings.py
  • No mixing LDAP code with rest of codebase

Fixes #1664

🤖 Generated with Claude Code


Summary by cubic

Adds native LDAP authentication with a dedicated Django app and config. Optional and only enabled when django-auth-ldap is installed and LDAP_ENABLED=True. Addresses #1664.

  • New Features

    • LDAPConfig with validation and conditional loading.
    • Custom backend supports LDAP user search, attribute mapping, and LDAP_CREATE_SUPERUSER.
    • Clear error messages when dependencies or config are missing.
    • Tests cover defaults, validation, settings integration, and CLI behavior.
  • Migration

    • Install deps: pip install archivebox[ldap].
    • Set env/config: LDAP_ENABLED=True, LDAP_SERVER_URI, LDAP_BIND_DN, LDAP_BIND_PASSWORD, LDAP_USER_BASE.
    • Optional: LDAP_USER_FILTER, LDAP_USERNAME_ATTR, LDAP_FIRSTNAME_ATTR, LDAP_LASTNAME_ATTR, LDAP_EMAIL_ATTR, LDAP_CREATE_SUPERUSER.

Written for commit c2bb4b25cb. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ArchiveBox/ArchiveBox/pull/1756 **Author:** [@pirate](https://github.com/pirate) **Created:** 1/6/2026 **Status:** ✅ Merged **Merged:** 1/6/2026 **Merged by:** [@pirate](https://github.com/pirate) **Base:** `dev` ← **Head:** `claude/issue-1664-20260105-2125` --- ### 📝 Commits (1) - [`c2bb4b2`](https://github.com/ArchiveBox/ArchiveBox/commit/c2bb4b25cb849b56718fedc3ae18b3e4e10895ca) Implement native LDAP authentication support ### 📊 Changes **7 files changed** (+415 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `archivebox/config/__init__.py` (+2 -0) ➕ `archivebox/config/ldap.py` (+56 -0) 📝 `archivebox/core/settings.py` (+60 -10) ➕ `archivebox/ldap/__init__.py` (+17 -0) ➕ `archivebox/ldap/apps.py` (+13 -0) ➕ `archivebox/ldap/auth.py` (+49 -0) ➕ `archivebox/tests/test_auth_ldap.py` (+218 -0) </details> ### 📄 Description ## Summary Implements native LDAP authentication support for ArchiveBox. ## Changes - Create `archivebox/config/ldap.py` with LDAPConfig class - Create `archivebox/ldap/` Django app with custom auth backend - Update `core/settings.py` to conditionally load LDAP when enabled - Add LDAP_CREATE_SUPERUSER support to auto-grant superuser privileges - Add comprehensive tests in test_auth_ldap.py (no mocks, no skips) - LDAP only activates if django-auth-ldap is installed and LDAP_ENABLED=True - Helpful error messages when LDAP libraries are missing or config is incomplete ## Implementation Approach - ✅ Native integration (not a plugin) - ✅ Conditional loading based on libraries + config - ✅ Separate Django app for LDAP logic - ✅ Clean if statements in settings.py - ✅ No mixing LDAP code with rest of codebase Fixes #1664 🤖 Generated with [Claude Code](https://claude.ai/code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds native LDAP authentication with a dedicated Django app and config. Optional and only enabled when django-auth-ldap is installed and LDAP_ENABLED=True. Addresses #1664. - **New Features** - LDAPConfig with validation and conditional loading. - Custom backend supports LDAP user search, attribute mapping, and LDAP_CREATE_SUPERUSER. - Clear error messages when dependencies or config are missing. - Tests cover defaults, validation, settings integration, and CLI behavior. - **Migration** - Install deps: pip install archivebox[ldap]. - Set env/config: LDAP_ENABLED=True, LDAP_SERVER_URI, LDAP_BIND_DN, LDAP_BIND_PASSWORD, LDAP_USER_BASE. - Optional: LDAP_USER_FILTER, LDAP_USERNAME_ATTR, LDAP_FIRSTNAME_ATTR, LDAP_LASTNAME_ATTR, LDAP_EMAIL_ATTR, LDAP_CREATE_SUPERUSER. <sup>Written for commit c2bb4b25cb849b56718fedc3ae18b3e4e10895ca. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-15 01:49:02 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#4518
No description provided.