Mark LDAP user query timeout as incorrect login instead of disabling user immediately#11220
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR modifies LDAP authentication to treat user query timeouts as incorrect login attempts rather than immediately disabling the user. Key changes include:
- Enhanced exception messages and logging in
LdapManagerImpl. - Added timeout detection in
LdapAuthenticatorto increment incorrect login counts on read timeouts. - Minor logging addition in
LdapListUsersCmdfor empty-list cases.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| LdapManagerImpl.java | Improved exception logging and enriched error messages with cause detail. |
| LdapAuthenticator.java | Introduced LDAP_READ_TIMED_OUT_MESSAGE, updated authentication flows to handle timeouts, and refactored processResultAndAction. |
| LdapListUsersCmd.java | Added debug logging for LDAP lookup failures. |
Comments suppressed due to low confidence (2)
plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapAuthenticator.java:178
- There’s no existing unit test for the LDAP read timeout path. Add tests to verify that a timeout increments the incorrect login count and does not disable the user.
logger.debug(e.getMessage());
plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapAuthenticator.java:298
- The condition
(user != null || timedOut)causes all failures for non-null users to increment the login count, not just timeouts. Verify this matches intended behavior and consider separating the two cases.
return (!result && (user != null || timedOut)) ?
...er-authenticators/ldap/src/main/java/org/apache/cloudstack/api/command/LdapListUsersCmd.java
Outdated
Show resolved
Hide resolved
...ins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapAuthenticator.java
Outdated
Show resolved
Hide resolved
plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java
Show resolved
Hide resolved
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #11220 +/- ##
============================================
- Coverage 16.16% 16.16% -0.01%
+ Complexity 13276 13275 -1
============================================
Files 5656 5656
Lines 497791 497800 +9
Branches 60366 60367 +1
============================================
- Hits 80456 80446 -10
- Misses 408381 408401 +20
+ Partials 8954 8953 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
...er-authenticators/ldap/src/main/java/org/apache/cloudstack/api/command/LdapListUsersCmd.java
Outdated
Show resolved
Hide resolved
shwstppr
left a comment
There was a problem hiding this comment.
code looks good. One minor comment
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✖️ debian ✔️ suse15. SL-JID 14207 |
...ins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapAuthenticator.java
Outdated
Show resolved
Hide resolved
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 14227 |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 14229 |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✖️ debian ✔️ suse15. SL-JID 14251 |
|
@blueorangutan test |
|
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-13822)
|
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM
Tested with a docker image of Openldap (https://github.com/osixia/docker-openldap) and we are not disable the user when there is certain timeout
…user immediately (apache#11220) * Mark LDAP user query timeout as incorrect login instead of disabling user immediately * code improvements
Description
This PR marks the LDAP user query timeout as incorrect login instead of disabling user immediately.
Fixes #11199
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?