-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAuthController.java
More file actions
34 lines (26 loc) · 1.03 KB
/
AuthController.java
File metadata and controls
34 lines (26 loc) · 1.03 KB
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
29
30
31
32
33
34
package com.example.notes.controller;
import com.example.notes.entity.User;
import com.example.notes.jwt.JwtTokenUtil;
import com.example.notes.mapper.JwtMapper;
import com.example.notes.service.JwtUserDetailsService;
import com.example.notes.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.web.bind.annotation.*;
@RestController
public class AuthController {
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Autowired
private JwtUserDetailsService userDetailsService;
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = "/register", method = RequestMethod.POST)
public ResponseEntity<?> saveUser(@RequestBody User user) throws Exception {
System.out.println("Came here");
return ResponseEntity.ok(userDetailsService.save(user));
}
}