| | |
| | | import com.se.auth.form.RegisterBody; |
| | | import com.se.auth.service.SysLoginService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.se.common.core.domain.R; |
| | | import com.se.common.core.utils.JwtUtils; |
| | | import com.se.common.core.utils.StringUtils; |
| | |
| | | return R.ok(tokenService.createToken(userInfo)); |
| | | } |
| | | |
| | | @GetMapping("validate") |
| | | @PostMapping("validate") |
| | | public R<Object> validate(HttpServletRequest request) { |
| | | try { |
| | | boolean flag = false; |
| | | String token = SecurityUtils.getToken(request); |
| | | if (!StringUtils.isNotEmpty(token)) { |
| | | String userName = JwtUtils.getUserName(token); |
| | | flag = !StringUtils.isEmpty(userName); |
| | | } |
| | | |
| | | return R.ok(flag); |
| | | } catch (Exception ex) { |
| | | return R.fail(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping("logout") |
| | | public R<?> logout(HttpServletRequest request) |
| | | { |