Skip to content

Improve user not found exception message in InMemoryUserDetailsManager #16497

Closed
@jzheaux

Description

@jzheaux

InMemoryUserDetailsManager adds the username as the exception message for UsernameNotFoundException.

Outside of the context of this exception (for example when wrapped by another exception), the meaning of this message is harder to decipher.

Conventionally, Spring Security uses UsernameNotFoundException with a message like:

new UsernameNotFoundException("user '" + username + "' not found");

Making this change to InMemoryUserDetailsManager will make the exception message more informative and align it's behavior with the rest of Spring Security.

Metadata

Metadata

Assignees

Labels

in: coreAn issue in spring-security-coretype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions