[PR #5055] [MERGED] LDAP via simple auth separate bind user and search base #17617

Closed
opened 2025-11-02 14:30:10 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/5055
Author: @tenacubus
Created: 10/9/2018
Status: Merged
Merged: 12/27/2018
Merged by: @techknowlogick

Base: masterHead: LDAP-simple-AD-fix


📝 Commits (6)

  • 0e71d2a show userbase on simple LDAP
  • 9924b9c refactor findUserDN func; pull BindDN code out
  • ca4f99b simple LDAP - UserBase find full UserDN
  • 6490389 user_base only required for BindDN
  • b623fb9 Merge branch 'master' into LDAP-simple-AD-fix
  • 8ba0f99 Merge branch 'master' into LDAP-simple-AD-fix

📊 Changes

4 files changed (+37 additions, -17 deletions)

View changed files

📝 modules/auth/ldap/ldap.go (+29 -11)
📝 public/js/index.js (+4 -2)
📝 templates/admin/auth/edit.tmpl (+3 -3)
📝 templates/admin/auth/source/ldap.tmpl (+1 -1)

📄 Description

Resolves #3048

If you're using Active Directory and need to bind using the format user@domain.org or DOMAIN\user LDAP simple auth will fail. The problem is that UserDN setting we bind on is also used for the search base and it's not a qualified DN.

To solve this I added the User Search Base field previously only on LDAP via BindDN to the simple auth as well. If you have a setting in this field on simple auth it will use that as the LDAP search base instead of the UserDN.

It works but I'm not a huge fan of my code to have User Search Base only required for BindDN but not simple auth. If somebody has suggestions for how to do it cleanly I'm open. The existing classes and js didn't have a good way for a field to be in both but only required in one.


🔄 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-gitea/gitea/pull/5055 **Author:** [@tenacubus](https://github.com/tenacubus) **Created:** 10/9/2018 **Status:** ✅ Merged **Merged:** 12/27/2018 **Merged by:** [@techknowlogick](https://github.com/techknowlogick) **Base:** `master` ← **Head:** `LDAP-simple-AD-fix` --- ### 📝 Commits (6) - [`0e71d2a`](https://github.com/go-gitea/gitea/commit/0e71d2a5f3ad83f8cc28f546f5137114d2fb83b4) show userbase on simple LDAP - [`9924b9c`](https://github.com/go-gitea/gitea/commit/9924b9c53063df87845f6c984f06017a6656d955) refactor findUserDN func; pull BindDN code out - [`ca4f99b`](https://github.com/go-gitea/gitea/commit/ca4f99be9b8c05a06d8030587cdef97b03bc15f4) simple LDAP - UserBase find full UserDN - [`6490389`](https://github.com/go-gitea/gitea/commit/649038981eee58ef797a360f256e679dfe9b59b9) user_base only required for BindDN - [`b623fb9`](https://github.com/go-gitea/gitea/commit/b623fb97522967470ca9537b1f585b22f795bdd8) Merge branch 'master' into LDAP-simple-AD-fix - [`8ba0f99`](https://github.com/go-gitea/gitea/commit/8ba0f99ae190980bc066a1ac1ef179c7ad184212) Merge branch 'master' into LDAP-simple-AD-fix ### 📊 Changes **4 files changed** (+37 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `modules/auth/ldap/ldap.go` (+29 -11) 📝 `public/js/index.js` (+4 -2) 📝 `templates/admin/auth/edit.tmpl` (+3 -3) 📝 `templates/admin/auth/source/ldap.tmpl` (+1 -1) </details> ### 📄 Description Resolves #3048 If you're using Active Directory and need to bind using the format user@domain.org or DOMAIN\user LDAP simple auth will fail. The problem is that UserDN setting we bind on is also used for the search base and it's not a qualified DN. To solve this I added the User Search Base field previously only on LDAP via BindDN to the simple auth as well. If you have a setting in this field on simple auth it will use that as the LDAP search base instead of the UserDN. It works but I'm not a huge fan of my code to have User Search Base only required for BindDN but not simple auth. If somebody has suggestions for how to do it cleanly I'm open. The existing classes and js didn't have a good way for a field to be in both but only required in one. --- <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 2025-11-02 14:30:10 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17617