Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @CrossOrigin(origins = "*", maxAge = 3600)
- @RestController
- @RequestMapping("/api/auth")
- @RequiredArgsConstructor
- public class AuthController {
- private final AuthenticationManager authenticationManager;
- private final AuthService authService;
- @PostMapping("/signin")
- public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest loginRequest) {
- return authService.authenticateUser(loginRequest);
- }
- @PostMapping("/signup")
- public ResponseEntity<?> registerUser(@Valid @RequestBody SignupRequest signUpRequest) {
- return authService.registerUser(signUpRequest);
- }
- @GetMapping("/verify/{verificationCode}")
- public String verifyUser(@PathVariable("verificationCode") String verificationCode) {
- if (authService.verify(verificationCode)) {
- return "verify_success";
- } else {
- return "verify_fail";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment