In the development of Java Web project, security authorization authentication mechanism is added
auth.inMemoryAuthentication().withUser("a").password("123456").roles("admin");
After the login page is submitted, the background display is abnormal
java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”
The main idea is that there is no password mapping added for ID. the code is adjusted according to the exception, and the passwordencoder method is added, as follows
auth.inMemoryAuthentication().passwordEncoder(new
BCryptPasswordEncoder()).withUser("a").password(new BCryptPasswordEncoder().encode("123456")).roles("admin");
Run the program again and submit the account and password on the login page without exception
Similar Posts:
- [Solved] java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”
- Problems of bad credentials, encoded password does not look like bcrypt in spring-cloud-oauth2 upgrade
- Error occurred when using java to connect mongodb: command failed with error 18 (authentication failed): “authentication failed.”
- Mongovue is unable to create collections and log in with user name and password
- Missing value auth-url required for auth plugin password [Solved]
- How to Solve MongoDB Error: Authentication failed.
- Mongodb access control is not enabled for the database
- When deploying Tomcat service, resolve the cannot invoke Tomcat manager exception
- [Solved] openstack Missing value auth-url required for auth plugin password
- mongodb not authorized on admin to execute command [version 3.2.18]