2020-05-19 13:15:35 +07:00
|
|
|
package com.chantha.jdbc.security
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
|
|
import org.springframework.security.core.userdetails.UserDetails
|
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService
|
|
|
|
import org.springframework.stereotype.Service
|
|
|
|
|
|
|
|
@Service
|
|
|
|
class UserDetailServiceImpl @Autowired constructor(private val userRepo: UserRepo):UserDetailsService {
|
2020-05-19 15:30:16 +07:00
|
|
|
@Throws(Exception::class)
|
2020-05-19 13:15:35 +07:00
|
|
|
override fun loadUserByUsername(p0: String?): UserDetails {
|
|
|
|
val user=userRepo.findByUsername(p0!!)
|
|
|
|
return UserPrincipal(user)
|
|
|
|
}
|
2020-05-19 15:30:16 +07:00
|
|
|
|
2020-05-19 13:15:35 +07:00
|
|
|
}
|