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.

Comment From: Tejas-Teju

Hey @jzheaux Can you assign it to me? Let me make the changes

Comment From: jzheaux

For sure, @Tejas-Teju! 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.