also <https://stackoverflow.com/questions/32970923...
# spring
c
That's a different problem I've solved before I bumped into the one I asked about 🙂
In the end I ended up with this:
Copy code
@Bean
	fun userDetailsService() = UserDetailsService { username: String ->
		userAccountRepository.findByUsernameLowerCased(username.toLowerCase())?.toUserDetails()
				?: throw UsernameNotFoundException("Could not find user with username $username")
	}
private fun UserAccount.toUserDetails(): UserDetails = User(
		username, password, enabled,
		true, true, true,
		setOf(SimpleGrantedAuthority("USER")))