提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.api.oauth2; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO; |
|
5 |
import com.iailab.module.system.api.oauth2.dto.OAuth2AccessTokenCreateReqDTO; |
|
6 |
import com.iailab.module.system.api.oauth2.dto.OAuth2AccessTokenRespDTO; |
|
7 |
import com.iailab.module.system.enums.ApiConstants; |
|
8 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
9 |
import io.swagger.v3.oas.annotations.Parameter; |
|
10 |
import io.swagger.v3.oas.annotations.Parameters; |
|
11 |
import io.swagger.v3.oas.annotations.Operation; |
|
12 |
import org.springframework.cloud.openfeign.FeignClient; |
|
13 |
import org.springframework.web.bind.annotation.*; |
|
14 |
|
|
15 |
import javax.validation.Valid; |
|
16 |
|
1ecdfb
|
17 |
@FeignClient(name = ApiConstants.NAME) |
e7c126
|
18 |
@Tag(name = "RPC 服务 - OAuth2.0 令牌") |
H |
19 |
public interface OAuth2TokenApi { |
|
20 |
|
|
21 |
String PREFIX = ApiConstants.PREFIX + "/oauth2/token"; |
|
22 |
|
|
23 |
/** |
|
24 |
* 校验 Token 的 URL 地址,主要是提供给 Gateway 使用 |
|
25 |
*/ |
|
26 |
@SuppressWarnings("HttpUrlsUsage") |
|
27 |
String URL_CHECK = "http://" + ApiConstants.NAME + PREFIX + "/check"; |
|
28 |
|
|
29 |
@PostMapping(PREFIX + "/create") |
|
30 |
@Operation(summary = "创建访问令牌") |
|
31 |
CommonResult<OAuth2AccessTokenRespDTO> createAccessToken(@Valid @RequestBody OAuth2AccessTokenCreateReqDTO reqDTO); |
|
32 |
|
|
33 |
@GetMapping(PREFIX + "/check") |
|
34 |
@Operation(summary = "校验访问令牌") |
|
35 |
@Parameter(name = "accessToken", description = "访问令牌", required = true, example = "tudou") |
|
36 |
CommonResult<OAuth2AccessTokenCheckRespDTO> checkAccessToken(@RequestParam("accessToken") String accessToken); |
|
37 |
|
|
38 |
@DeleteMapping(PREFIX + "/remove") |
|
39 |
@Operation(summary = "移除访问令牌") |
|
40 |
@Parameter(name = "accessToken", description = "访问令牌", required = true, example = "tudou") |
|
41 |
CommonResult<OAuth2AccessTokenRespDTO> removeAccessToken(@RequestParam("accessToken") String accessToken); |
|
42 |
|
|
43 |
@PutMapping(PREFIX + "/refresh") |
|
44 |
@Operation(summary = "刷新访问令牌") |
|
45 |
@Parameters({ |
|
46 |
@Parameter(name = "refreshToken", description = "刷新令牌", required = true, example = "haha"), |
7da8f1
|
47 |
@Parameter(name = "clientId", description = "客户端编号", required = true, example = "iailab") |
e7c126
|
48 |
}) |
H |
49 |
CommonResult<OAuth2AccessTokenRespDTO> refreshAccessToken(@RequestParam("refreshToken") String refreshToken, |
|
50 |
@RequestParam("clientId") String clientId); |
|
51 |
|
|
52 |
} |