-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathLoginController.java
28 lines (23 loc) · 989 Bytes
/
LoginController.java
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
package nextstep.app.ui;
import nextstep.security.service.MemberRepository;
import nextstep.security.exception.AuthenticationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LoginController {
private final MemberRepository memberRepository;
public LoginController(MemberRepository memberRepository) {
this.memberRepository = memberRepository;
}
@PostMapping("/login")
public ResponseEntity<Void> login() throws AuthenticationException {
return ResponseEntity.ok().build();
}
@ExceptionHandler(AuthenticationException.class)
public ResponseEntity<Void> handleAuthenticationException() {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
}
}