Search in sources :

Example 1 with SecurityUser

use of com.laurentiuspilca.ssc6.security.model.SecurityUser in project youtubechannel by lspil.

the class JpaUserDetailsService method loadUserByUsername.

@Override
public UserDetails loadUserByUsername(String username) {
    var o = userRepository.findUserByUsername(username);
    User u = o.orElseThrow(() -> new UsernameNotFoundException(":("));
    return new SecurityUser(u);
}
Also used : UsernameNotFoundException(org.springframework.security.core.userdetails.UsernameNotFoundException) SecurityUser(com.laurentiuspilca.ssc6.security.model.SecurityUser) User(com.laurentiuspilca.ssc6.entities.User) SecurityUser(com.laurentiuspilca.ssc6.security.model.SecurityUser)

Aggregations

User (com.laurentiuspilca.ssc6.entities.User)1 SecurityUser (com.laurentiuspilca.ssc6.security.model.SecurityUser)1 UsernameNotFoundException (org.springframework.security.core.userdetails.UsernameNotFoundException)1