feat(auth): add LDAP / Active Directory authentication support#3148
Open
crivetimihai wants to merge 2 commits intomainfrom
Open
feat(auth): add LDAP / Active Directory authentication support#3148crivetimihai wants to merge 2 commits intomainfrom
crivetimihai wants to merge 2 commits intomainfrom
Conversation
Implement LDAP bind authentication, directory sync, and Docker infrastructure for local development/testing with OpenLDAP. - LDAP simple bind login (service account search + user bind) - Auto-provisioning of gateway users from LDAP entries - LDAP group-to-role mapping with configurable role_mappings - Periodic background directory sync (users + groups → teams) - Orphan user removal on sync (opt-in via LDAP_SYNC_DELETE_ORPHANS) - Docker Compose profile with OpenLDAP + phpLDAPadmin + seed data - Makefile targets: compose-ldap, compose-ldap-seed, compose-ldap-down, compose-ldap-clean - 29 configuration settings via environment variables - Security hardening: StartTLS before bind, account lockout, auth provider isolation, role refresh on login, admin-only status endpoint - 70 unit tests (service + router) Closes #284 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AUTO_BIND_TLS_BEFORE_BIND), account lockout integration, auth provider isolation (prevents LDAP takeover of local accounts), role refresh on every login, admin-only status endpoint with sanitized error messagesNew files
mcpgateway/services/ldap_service.pymcpgateway/routers/ldap_auth.py/auth/ldap/login,/auth/ldap/status,/auth/ldap/syncdocker-compose.ldap.ymlinfra/ldap/seed.ldiftests/unit/mcpgateway/services/test_ldap_service.pytests/unit/mcpgateway/routers/test_ldap_auth.pyModified files
mcpgateway/config.pymcpgateway/schemas.pyLdapLoginRequest,LdapSyncResponse,LdapStatusResponsemcpgateway/main.pydocker-compose.ymlldapprofilepyproject.tomlldap3>=2.9.1optional dependency ([ldap]extra).env.exampleMakefilecompose-ldap,compose-ldap-seed,compose-ldap-down,compose-ldap-cleanTest plan
make compose-ldap && make compose-ldap-seedthen test login via/auth/ldap/loginPOST /auth/ldap/syncimports users/groups as teamsLDAP_START_TLS=trueCloses #284