cz.muni.fi.pa165.library.backend.User user = userDAO.findUserByEmail(email);
List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>(2);
String pass;
if (user != null){
pass = user.getPassword();
authList.add(new GrantedAuthorityImpl("ROLE_LIBRARIAN"));
authList.add(new GrantedAuthorityImpl("ROLE_READER"));
}else{
Reader reader = readerDAO.findReaderByEmail(email);
if (reader == null){throw new UsernameNotFoundException("Username Not Found");}
pass = reader.getPassword();
authList.add(new GrantedAuthorityImpl("ROLE_READER"));
}
return new User(email, pass, true, true, true, true, authList);