Skip to content

AbstractUserDetailsAuthenticationProvider should not swallow UsernameNotFoundException #16496

Open
@jzheaux

Description

@jzheaux

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);
}

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions