| | |
| | | import com.linghu.model.entity.User; |
| | | import com.linghu.utils.JwtUtils; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | @Api(value = "认证接口", tags = "认证管理") |
| | | @RestController |
| | | @RequestMapping("/auth") |
| | | public class AuthController { |
| | |
| | | private String secretKey; |
| | | |
| | | @PostMapping("/login") |
| | | @ApiOperation(value = "外部登录") |
| | | public ResponseEntity<?> externalLogin( |
| | | @RequestBody User user) { |
| | | |
| | |
| | | |
| | | // 获取用户信息 |
| | | @PostMapping("/getUserInfo") |
| | | @ApiOperation(value = "获取用户信息") |
| | | public ResponseEntity<?> getUserInfo(@RequestParam String token) { |
| | | // 解析JWT令牌,获取用户信息 |
| | | JwtUtils jwtUtils = new JwtUtils(secretKey, 3600); |