@@ -0,0 +1,1528 @@
+package pl.filmbox.services.implementations;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.security.core.GrantedAuthority;%0Aimport org.springframework.security.core.authority.SimpleGrantedAuthority;%0Aimport org.springframework.security.core.userdetails.UserDetails;%0Aimport org.springframework.security.core.userdetails.UserDetailsService;%0Aimport org.springframework.security.core.userdetails.UsernameNotFoundException;%0Aimport org.springframework.stereotype.Service;%0Aimport pl.filmbox.models.Credit;%0Aimport pl.filmbox.models.User;%0Aimport pl.filmbox.repositories.UserRepository;%0A%0Aimport javax.transaction.Transactional;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A@Service%0A@Transactional%0Apublic class UserDetailServiceImpl implements UserDetailsService %7B%0A%0A    private UserRepository userRepository;%0A%0A    @Autowired%0A    public UserDetailServiceImpl(UserRepository userRepository) %7B%0A        this.userRepository = userRepository;%0A    %7D%0A%0A    @Override%0A    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException %7B%0A        User user = userRepository.getUserByUsername(username);%0A%0A        Set%3CGrantedAuthority%3E grantedAuthorities = new HashSet%3C%3E();%0A        for (Credit credit : user.getCredits())%7B%0A            grantedAuthorities.add(new SimpleGrantedAuthority(credit.getName()));%0A        %7D%0A%0A        return new org.springframework.security.core.userdetails.User(%0A                user.getUsername(), user.getPassword(), grantedAuthorities%0A        );%0A    %7D%0A%7D%0A

Create UserDetailService (login feature)