Last change
on this file since 5306751 was 3fc9e50, checked in by KostaFortumanov <kfortumanov@…>, 3 years ago |
prototip part1
|
-
Property mode
set to
100644
|
File size:
899 bytes
|
Line | |
---|
1 | package it.finki.charitable.services;
|
---|
2 |
|
---|
3 | import it.finki.charitable.entities.AppUser;
|
---|
4 | import it.finki.charitable.repository.UserRepository;
|
---|
5 | import org.springframework.security.core.userdetails.UserDetailsService;
|
---|
6 | import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
---|
7 | import org.springframework.stereotype.Service;
|
---|
8 |
|
---|
9 | @Service
|
---|
10 | public class UserService implements UserDetailsService {
|
---|
11 |
|
---|
12 | private final UserRepository userRepository;
|
---|
13 |
|
---|
14 | public UserService(UserRepository userRepository) {
|
---|
15 | this.userRepository = userRepository;
|
---|
16 | }
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public AppUser loadUserByUsername(String s) throws UsernameNotFoundException {
|
---|
20 | return userRepository.findByEmail(s).orElse(null);
|
---|
21 | }
|
---|
22 |
|
---|
23 | public void saveUser(AppUser user) {
|
---|
24 | userRepository.save(user);
|
---|
25 | }
|
---|
26 |
|
---|
27 | public void deleteUser(AppUser user) {
|
---|
28 | userRepository.delete(user);
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.