main
Last change
on this file since 08f82ec was d8b6c91, checked in by 223021 <daniel.ilievski.2@…>, 2 months ago |
Initial commit - implementirano registracija i logiranje so Spring Security i JSON Web Token-i vo backend-ot kako i navbar i formi za istoto vo frontend-ot
|
-
Property mode
set to
100644
|
File size:
957 bytes
|
Line | |
---|
1 | package mk.ukim.finki.predmeti.internettehnologii.jobvistabackend.service.impl;
|
---|
2 |
|
---|
3 |
|
---|
4 | import lombok.AllArgsConstructor;
|
---|
5 | import mk.ukim.finki.predmeti.internettehnologii.jobvistabackend.repositories.UserRepository;
|
---|
6 | import org.springframework.security.core.userdetails.UserDetails;
|
---|
7 | import org.springframework.security.core.userdetails.UserDetailsService;
|
---|
8 | import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
---|
9 | import org.springframework.stereotype.Service;
|
---|
10 | import org.springframework.transaction.annotation.Transactional;
|
---|
11 |
|
---|
12 | @Service
|
---|
13 | @AllArgsConstructor
|
---|
14 | @Transactional
|
---|
15 | public class UserDetailsServiceImpl implements UserDetailsService {
|
---|
16 | private final UserRepository userRepository;
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
---|
20 | return userRepository.findByEmail(username)
|
---|
21 | .orElseThrow(() -> new UsernameNotFoundException("User not found"));
|
---|
22 | }
|
---|
23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.