[PR #1756] Implement native LDAP authentication #3016

Closed
opened 2026-03-01 18:01:24 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/ArchiveBox/ArchiveBox/pull/1756

State: closed
Merged: Yes


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.

**Original Pull Request:** https://github.com/ArchiveBox/ArchiveBox/pull/1756 **State:** closed **Merged:** Yes --- ## 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. -->
kerem 2026-03-01 18:01:24 +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#3016
No description provided.