// Path: src/main/java/com/pollistics/services/UserService.java
// @Service
// public class UserService implements UserDetailsService {
// 
// 	@Autowired
// 	private UserRepository userRepository;
// 
// 	public boolean userExists(String username) {
// 		return userRepository.findByUsername(username) != null;
// 	}
// 
// 	public void createUser(User user) {
// 		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// 		String hashedPassword = passwordEncoder.encode(user.getPassword());
// 		user.setPassword(hashedPassword);
// 		userRepository.insert(user);
// 	}
// 
// 	@Override
// 	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// 		User user = userRepository.findByUsername(username);
// 		if(user == null){
// 			throw new UsernameNotFoundException(username);
// 		} else{
// 			return user;
// 		}
// 	}
// }


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.csrf.CsrfTokenRepository;
import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository;
import com.pollistics.services.UserService;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
package com.pollistics.config;




@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
	@Autowired
// Path: src/main/java/com/pollistics/services/UserService.java
// @Service
// public class UserService implements UserDetailsService {
// 
// 	@Autowired
// 	private UserRepository userRepository;
// 
// 	public boolean userExists(String username) {
// 		return userRepository.findByUsername(username) != null;
// 	}
// 
// 	public void createUser(User user) {
// 		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// 		String hashedPassword = passwordEncoder.encode(user.getPassword());
// 		user.setPassword(hashedPassword);
// 		userRepository.insert(user);
// 	}
// 
// 	@Override
// 	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// 		User user = userRepository.findByUsername(username);
// 		if(user == null){
// 			throw new UsernameNotFoundException(username);
// 		} else{
// 			return user;
// 		}
// 	}
// }


// Path: src/main/java/com/pollistics/config/WebSecurityConfig.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.csrf.CsrfTokenRepository;
import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository;
import com.pollistics.services.UserService;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

package com.pollistics.config;




@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
	@Autowired
	private UserService userService;