|
|
@ -3,9 +3,12 @@ package cc.bnblogs.springinit.service; |
|
|
|
import cc.bnblogs.springinit.mapper.UserMapper; |
|
|
|
import cc.bnblogs.springinit.mapper.UserMapper; |
|
|
|
import cc.bnblogs.springinit.pojo.MyUser; |
|
|
|
import cc.bnblogs.springinit.pojo.MyUser; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.security.core.userdetails.UserDetails; |
|
|
|
import org.springframework.security.core.userdetails.UserDetails; |
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
|
|
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|
|
|
|
|
|
|
import org.springframework.security.crypto.password.PasswordEncoder; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@Service |
|
|
@ -22,4 +25,9 @@ public class CustomUserDetailsService implements UserDetailsService { |
|
|
|
} |
|
|
|
} |
|
|
|
return user; |
|
|
|
return user; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
|
|
|
public PasswordEncoder passwordEncoder() { |
|
|
|
|
|
|
|
return new BCryptPasswordEncoder(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|