spring-projects / spring-projects/spring-security
Endless Authentication Loop with ActiveDirectoryLdapAuthenticationProvider on Incorrect Password
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Describe the bug
Encountering an endless Authentication loop with Spring Security version 6.2.2 when incorrect LDAP credentials are provided. This occurs in a custom AuthenticationProvider that utilizes ActiveDirectoryLdapAuthenticationProvider. The error stems from recursive calls between an AuthenticationProvider and its parent, similar to issues discussed in related threads and #4203.
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,124 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,135 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,144 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,154 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,166 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,176 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,185 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,195 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
FINEST|13344/1|Service com.[redacted].console.[redacted]Console|24-04-11 14:44:04|11 Apr 2024 14:44:04,205 INFO [tomcat-handler-96] (ActiveDirectoryLdapAuthenticationProvider.java:236) - Active Directory authentication failed: Supplied password was invalid
To Reproduce
- Configure ActiveDirectoryLdapAuthenticationProvider in a custom AuthenticationProvider.
- Implement a condition within the custom provider that leads to delegation to a parent AuthenticationProvider.
- Attempt LDAP authentication with an incorrect password.
Expected behavior
is expected to gracefully handle incorrect LDAP authentication attempts by throwing an AuthenticationException, not an Endless Authentication Loop , due to recursive provider delegation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ActiveDirectoryLdapAuthenticationProvider and the custom AuthenticationProvider delegation described in the reproduction steps, then compare the behavior with related issue #4203. Reproduce an incorrect-password attempt with a parent provider; done means it raises an AuthenticationException once instead of recursively delegating and logging an endless loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100