-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserServiceImpl.java
More file actions
41 lines (34 loc) · 1.27 KB
/
UserServiceImpl.java
File metadata and controls
41 lines (34 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.projectpet.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import com.projectpet.model.User;
import com.projectpet.repository.UserRepository;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Override
public User searchUser(String username, String password) {
// TODO Auto-generated method stub
User user=userRepository.findByUsernameAndPassword(username,password);
//if (user == null) {
// throw new UsernameNotFoundException("Invalid username or password");}
return user;
}
@Override
public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public void save(User user) {
userRepository.save(user);
}
@Override
public User findByUsername(String username) {
return userRepository.findByUsername(username);
}
}