File tree 2 files changed +28
-1
lines changed
src/main/java/com/appsdeveloperblog/app/ws/mobile_app_ws
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 7
7
import com .appsdeveloperblog .app .ws .mobile_app_ws .shared .dto .UserDto ;
8
8
import org .springframework .beans .BeanUtils ;
9
9
import org .springframework .beans .factory .annotation .Autowired ;
10
+ import org .springframework .security .core .userdetails .User ;
10
11
import org .springframework .security .core .userdetails .UserDetails ;
11
12
import org .springframework .security .core .userdetails .UsernameNotFoundException ;
12
13
import org .springframework .security .crypto .bcrypt .BCryptPasswordEncoder ;
13
14
import org .springframework .stereotype .Service ;
14
15
16
+ import java .util .ArrayList ;
17
+
15
18
@ Service
16
19
public class UserServiceImpl implements UserService {
17
20
@@ -47,6 +50,8 @@ public UserDto createUser(UserDto user) {
47
50
48
51
@ Override
49
52
public UserDetails loadUserByUsername (String username ) throws UsernameNotFoundException {
50
- return null ;
53
+ UserEntity userEntity =userRepository .findByEmail (username );
54
+ if (userEntity ==null ) throw new UsernameNotFoundException (username );
55
+ return new User (username ,userEntity .getEncryptedPassword (),new ArrayList <>());
51
56
}
52
57
}
Original file line number Diff line number Diff line change
1
+ package com .appsdeveloperblog .app .ws .mobile_app_ws .ui .model .request ;
2
+
3
+ public class UserLoginRequestModel {
4
+ private String email ;
5
+ private String password ;
6
+
7
+ public String getEmail () {
8
+ return email ;
9
+ }
10
+
11
+ public void setEmail (String email ) {
12
+ this .email = email ;
13
+ }
14
+
15
+ public String getPassword () {
16
+ return password ;
17
+ }
18
+
19
+ public void setPassword (String password ) {
20
+ this .password = password ;
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments