|  |  |  | 
|---|
|  |  |  | import org.springframework.web.server.ServerWebExchange; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * JWT获取令牌和刷新令牌接口 | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("退出登陆") | 
|---|
|  |  |  | public ApiResponse<String> logout(@RequestHeader(Constants.HEADER_USER_TOKEN) String oldToken){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | jwtTokenUtil.logout(oldToken); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | jwtTokenUtil.logout(oldToken); | 
|---|
|  |  |  | }catch (BusinessException e){ | 
|---|
|  |  |  | return ApiResponse.failed(e.getCode(),e.getMessage()); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/logoutForH5") | 
|---|
|  |  |  | @ApiOperation("退出登陆") | 
|---|
|  |  |  | public ApiResponse<String> logoutForH5(@RequestHeader(Constants.HEADER_USER_TOKEN) String oldToken){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | jwtTokenUtil.logoutForH5(oldToken); | 
|---|
|  |  |  | }catch (BusinessException e){ | 
|---|
|  |  |  | return ApiResponse.failed(e.getCode(),e.getMessage()); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | return ApiResponse.failed(ResponseStatus.SERVER_ERROR); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 刷新JWT令牌,用旧的令牌换新的令牌 | 
|---|