org.springframework.security.authentication.InternalAuthenticationServiceE
xception: UserDetailsService returned null, which is an interface contract
violation\r\n\tat
org.springframework.security.authentication.dao.DaoAuthenticationProvider
.retrieveUser(DaoAuthenticationProvider.java:110)\r\n\tat
org.springframework.security.authentication.dao.AbstractUserDetailsAuthen
ticationProvider.authenticate
(AbstractUserDetailsAuthenticationProvider.java:144)\r\n\tat
org.springframework.security.authentication.ProviderManager.authenticate
(ProviderManager.java:175)\r\n\tat
org.springframework.security.authentication.ProviderManager.authenticate
(ProviderManager.java:195)
Solution
if your service class is implementing org.springframework.security.core.userdetails.UserDetailsService
you should implement loadUserByUsername()
and returns a new User(username,pass,rolesList)
public class yourServiceClass implements UserDetailsService {
//unimplemented method
loadUserByUsername(){
return new User(x,y,z);
}}
No comments:
Post a Comment
Your feedback may help others !!!