// Path: src/main/java/com/idugalic/security/domain/User.java
// @Entity
// @Table(name = "app_user")
// public class User {
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "id")
//     private Long id;
// 
//     @Column(name = "username")
//     private String username;
// 
//     @Column(name = "password")
//     private String password;
// 
//     @Column(name = "first_name")
//     private String firstName;
// 
//     @Column(name = "last_name")
//     private String lastName;
// 
//     /**
//      * Roles are being eagerly loaded here because
//      * they are a fairly small collection of items for this example.
//      */
//     @ManyToMany(fetch = FetchType.EAGER)
//     @JoinTable(name = "user_role", joinColumns
//             = @JoinColumn(name = "user_id",
//             referencedColumnName = "id"),
//             inverseJoinColumns = @JoinColumn(name = "role_id",
//                     referencedColumnName = "id"))
//     private List<Role> roles;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public List<Role> getRoles() {
//         return roles;
//     }
// 
//     public void setRoles(List<Role> roles) {
//         this.roles = roles;
//     }
// }
// 
// Path: src/main/java/com/idugalic/security/repository/UserRepository.java
// @RepositoryRestResource(collectionResourceRel = "users", path = "users")
// public interface UserRepository extends CrudRepository<User, Long> {
//     User findByUsername(String username);
// }


import com.idugalic.security.domain.User;
import com.idugalic.security.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
package com.idugalic.security.service.impl;





@Component
public class MyUserDetailsService implements UserDetailsService {
    @Autowired
// Path: src/main/java/com/idugalic/security/domain/User.java
// @Entity
// @Table(name = "app_user")
// public class User {
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "id")
//     private Long id;
// 
//     @Column(name = "username")
//     private String username;
// 
//     @Column(name = "password")
//     private String password;
// 
//     @Column(name = "first_name")
//     private String firstName;
// 
//     @Column(name = "last_name")
//     private String lastName;
// 
//     /**
//      * Roles are being eagerly loaded here because
//      * they are a fairly small collection of items for this example.
//      */
//     @ManyToMany(fetch = FetchType.EAGER)
//     @JoinTable(name = "user_role", joinColumns
//             = @JoinColumn(name = "user_id",
//             referencedColumnName = "id"),
//             inverseJoinColumns = @JoinColumn(name = "role_id",
//                     referencedColumnName = "id"))
//     private List<Role> roles;
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public List<Role> getRoles() {
//         return roles;
//     }
// 
//     public void setRoles(List<Role> roles) {
//         this.roles = roles;
//     }
// }
// 
// Path: src/main/java/com/idugalic/security/repository/UserRepository.java
// @RepositoryRestResource(collectionResourceRel = "users", path = "users")
// public interface UserRepository extends CrudRepository<User, Long> {
//     User findByUsername(String username);
// }


// Path: src/main/java/com/idugalic/security/service/impl/MyUserDetailsService.java
import com.idugalic.security.domain.User;
import com.idugalic.security.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;

package com.idugalic.security.service.impl;





@Component
public class MyUserDetailsService implements UserDetailsService {
    @Autowired
    private UserRepository userRepository;