Skip to content

feat: add opt-in LDAP and Active Directory authentication - #1412

Closed
maniaba wants to merge 2 commits into
codeigniter4:developfrom
maniaba:ladp
Closed

maniaba wants to merge 2 commits into
codeigniter4:developfrom
maniaba:ladp

Conversation

@maniaba

@maniaba maniaba commented Nov 24, 2026 •

Copy link
Copy Markdown

Description

Issue: #1413

Add opt-in LDAPv3 authentication for Active Directory and OpenLDAP. Applications register the ldap authenticator and direct their login POST route to it. LDAP verifies the directory credentials and uses Shield's existing users, sessions, login actions, and authorization checks.

  • Named connections support verified LDAPS or StartTLS, ordered endpoint failover, and bounded searches. Login filters escape submitted identifiers, and the transport rechecks eligibility and the immutable identity after the user bind.
  • Applications can explicitly link an existing Shield user or enable just-in-time provisioning and mapped profile updates. Links use a connection-scoped immutable ID such as AD objectGUID or OpenLDAP entryUUID. Shield does not store directory passwords.
  • Hybrid deployments can reserve local operator names and pin them to Shield user IDs. Those operators must complete a configured Shield login action.
  • The native transport uses optional ext-ldap. Identity links use the existing auth_identities table. Setup examples and bounded diagnostic APIs are documented in the LDAP guide.

Scope

Directory group filters can restrict login eligibility. Group assignment and synchronization, scheduled reconciliation, and revalidation of existing sessions are follow-up work.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

* feat: add verified LDAP transport and filter support

* feat: integrate optional LDAP login with Shield sessions

* docs: disable remembered sessions in LDAP-only setup

* refactor: align LDAP login and exceptions with Shield conventions

* refactor: standardize LDAP class and file names

* refactor: isolate LDAP from Shield login defaults

* test: cover LDAP authentication and transport edge cases

* fix: redact native LDAP passwords from exception traces

* docs: configure LDAP through Auth properties

* chore: trigger GitHub Actions for LDAP review

* docs: connect the LDAP guide and use a controller login action

* docs: document the public LDAP API

* test: resolve Psalm errors in LDAP tests

* fix: preload migrations config for Rector analysis

* fix: remove migrations config from Rector bootstrap

* refactor: configure LDAP connections through AuthLDAP properties

* docs: address LDAP guide review feedback

* chore: retrigger PR checks after LDAP guide review

* refactor: persist LDAP identities as UserIdentity entities

* test: run OpenLDAP integration checks in CI

* fix: restore Rector analysis for LDAP changes

@michalsn michalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'm not a big fan of adding LDAP support to the core. While I understand its usefulness in certain environments, I don't think it justifies the additional complexity and long-term maintenance overhead.

I'd rather see this implemented as a separate package that integrates with Shield. If our current architecture makes such an integration difficult, I'd be more in favor of improving Shield's extensibility than adding LDAP support directly to the core.

That said, let's see what others think. This is just my personal opinion.

maniaba added a commit to maniaba/shield-ldap that referenced this pull request Nov 27, 2026
Port the implementation, documentation, and LDAP test suites from codeigniter4/shield#1412 at d1965af1.
@datamweb

Copy link
Copy Markdown
Collaborator

@maniaba Thank you for your PR. However, I agree with @michalsn . I'm concerned that this approach could increase the long-term maintenance burden, especially considering that a separate package already exists for this functionality.

https://github.com/rakoitde/ci4-shield-ldap

@maniaba

maniaba commented Nov 28, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback, @datamweb and @michalsn.

I understand your concerns about long-term maintenance. I've already extracted the implementation into a standalone package: https://github.com/maniaba/shield-ldap.

This keeps LDAP support outside Shield's core, so I'll close this PR.

Thanks for your time and feedback!

@maniaba maniaba closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants