Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Security Turning On Spring Security with Java Config

gettin IllegalArgumentException on login

I got the following exception as i wanted to loging: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" Can someone help to solve this exception?

1 Answer

saykin
saykin
9,835 Points

Hello Freshta Moheby, in case you didn't figure this out yet. You might be using the newest Spring Security (version 5+) and it requires you to use encrypted passwords for production database handling. Since this isn't a production database, you need to specify in the SQL import file that these passwords are for testing purposes only. To do this, add {noop} in front of your passwords. Example line:

insert into user (username,enabled,password,role_id) values ('user', true, '{noop}password', 1);

If you have solved it, I hope someone else finds this useful.