spring-projects / spring-projects/spring-security

Endless Authentication Loop with ActiveDirectoryLdapAuthenticationProvider on Incorrect Password

Open
#14,886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: bug
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

  1. Configure ActiveDirectoryLdapAuthenticationProvider in a custom AuthenticationProvider.
  2. Implement a condition within the custom provider that leads to delegation to a parent AuthenticationProvider.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.