
上QQ阅读APP看书,第一时间看更新
Updating DefaultCalendarUserService
The passwordEncoder() method we defined previously is smart enough to handle the new password encoder interface. However, DefaultCalendarUserService needs to update to the new interface. Make the following updates to the DefaultCalendarUserService class:
//src/main/java/com/packtpub/springsecurity/service/DefaultCalendarService.java
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
// other imports omitted
public class DefaultCalendarService implements CalendarService {
...
public int createUser(CalendarUser user) {
String encodedPassword = passwordEncoder.encode(user.getPassword());
user.setPassword(encodedPassword);
...
return userId;
}
}