mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-12 01:59:34 -05:00
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!*