AbstractUserDetailsAuthenticationProvider catches UsernameNotFoundException, but does not include it when throwing BadCredentialsException.

Debugging would be improved if the stack trace included the original issue. This can be achieved by including the exception in the BadCredentialsException construction:

  // ...
} catch (UsernameNotFoundException ex) {
  // ...
  String message = this.messages
      .getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials")
  throw new BadCredentialsException(message, ex);
}

Comment From: kiruthiga1793

Hi @jzheaux , I am interested in working on this issue. Can you please assign it to me?

Comment From: jzheaux

For sure, @kiruthiga1793! I'm excited to work with you on this.

Even though it will likely be a small change, please take a moment to read our contribution guidelines.

Comment From: big-cir

I didn't see your assignment, sorry. Please close the pull request if you'd like.

Comment From: jzheaux

no problem @big-cir, let's check.

@kiruthiga1793, a PR has recently been submitted for this ticket. However, since you were the first to volunteer, I want to double-check with you if you'd still like to contribute the PR for this ticket?

Comment From: big-cir

@jzheaux

Thank you for suggestion!  😊 I’m okay with either option, so please feel free to proceed in the way that works best for you. I respect your decision and will fully support it.

Comment From: kiruthiga1793

Hi @jzheaux , If there are additional changes , I would like to contribute. Else, I don't want to waste the efforts of @big-cir