[PR #2226] [MERGED] feat(auth): allow LDAP authentication with anonymous bind #8124

Closed
opened 2026-04-20 18:03:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2226
Author: @Quiwy
Created: 2/11/2026
Status: Merged
Merged: 2/17/2026
Merged by: @kolaente

Base: mainHead: feat/ldap-anonymous-bind


📝 Commits (1)

  • 044c160 feat: allow anonymous LDAP bind

📊 Changes

2 files changed (+42 additions, -10 deletions)

View changed files

📝 pkg/modules/auth/ldap/ldap.go (+11 -10)
📝 pkg/modules/auth/ldap/ldap_test.go (+31 -0)

📄 Description

As discussed on Matrix, Vikunja currently prevents users from using LDAP authentication if the server allows anonymous binds (common in local environments like YunoHost). The application would previously trigger a log.Fatal if AuthLdapBindDN or AuthLdapBindPassword were left empty in the configuration.

How this fixes the problem:

  • Validation: Removed the strict requirement for Bind credentials in InitializeLDAPConnection.
  • Connection Logic: Updated ConnectAndBindToLDAPDirectory to attempt an UnauthenticatedBind from the go-ldap library when no credentials are provided.
  • Safety: If a Bind DN is provided, the behavior remains unchanged (authenticated bind).

Testing:

  • Tested manually on a YunoHost instance by replacing the binary.
  • Confirmed that Vikunja now successfully starts and authenticates users via the local LDAP (localhost) without requiring a service account.
  • Added a basic unit test in pkg/modules/auth/ldap/ldap_test.go to ensure the initialization logic doesn't crash with empty credentials.

Note: This is my first contribution to a Go project (assisted by an LLM for syntax). Feedback on code style is more than welcome!


🔄 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/go-vikunja/vikunja/pull/2226 **Author:** [@Quiwy](https://github.com/Quiwy) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/17/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `feat/ldap-anonymous-bind` --- ### 📝 Commits (1) - [`044c160`](https://github.com/go-vikunja/vikunja/commit/044c16009b1458d469d8701be98cc7a06e3cadf9) feat: allow anonymous LDAP bind ### 📊 Changes **2 files changed** (+42 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `pkg/modules/auth/ldap/ldap.go` (+11 -10) 📝 `pkg/modules/auth/ldap/ldap_test.go` (+31 -0) </details> ### 📄 Description As discussed on Matrix, Vikunja currently prevents users from using LDAP authentication if the server allows anonymous binds (common in local environments like YunoHost). The application would previously trigger a `log.Fatal` if `AuthLdapBindDN` or `AuthLdapBindPassword` were left empty in the configuration. #### **How this fixes the problem:** * **Validation:** Removed the strict requirement for Bind credentials in `InitializeLDAPConnection`. * **Connection Logic:** Updated `ConnectAndBindToLDAPDirectory` to attempt an `UnauthenticatedBind` from the `go-ldap` library when no credentials are provided. * **Safety:** If a Bind DN is provided, the behavior remains unchanged (authenticated bind). #### **Testing:** * Tested manually on a **YunoHost** instance by replacing the binary. * Confirmed that Vikunja now successfully starts and authenticates users via the local LDAP (localhost) without requiring a service account. * Added a basic unit test in `pkg/modules/auth/ldap/ldap_test.go` to ensure the initialization logic doesn't crash with empty credentials. *Note: This is my first contribution to a Go project (assisted by an LLM for syntax). Feedback on code style is more than welcome!* --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 18:03:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8124