1. system 提供 OAuth2TokenApi 接口

2. gateway 通过 feign 引入 OAuth2TokenApi 接口
This commit is contained in:
YunaiV
2022-06-03 01:11:13 +08:00
parent 94d62b8d79
commit e89ef5496c
7 changed files with 121 additions and 3 deletions

View File

@@ -29,6 +29,13 @@
<optional>true</optional>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.system.api.auth;
import cn.iocoder.yudao.module.system.api.auth.dto.OAuth2AccessTokenCheckRespDTO;
import cn.iocoder.yudao.module.system.api.auth.dto.OAuth2AccessTokenCreateReqDTO;
import cn.iocoder.yudao.module.system.api.auth.dto.OAuth2AccessTokenRespDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
@@ -11,6 +14,7 @@ import javax.validation.Valid;
*
* @author 芋道源码
*/
@FeignClient(name = "system-server") // TODO 芋艿fallbackFactory =
public interface OAuth2TokenApi {
/**
@@ -19,6 +23,7 @@ public interface OAuth2TokenApi {
* @param reqDTO 访问令牌的创建信息
* @return 访问令牌的信息
*/
@GetMapping("/tmp")
OAuth2AccessTokenRespDTO createAccessToken(@Valid OAuth2AccessTokenCreateReqDTO reqDTO);
/**
@@ -27,7 +32,8 @@ public interface OAuth2TokenApi {
* @param accessToken 访问令牌
* @return 访问令牌的信息
*/
OAuth2AccessTokenCheckRespDTO checkAccessToken(String accessToken);
@GetMapping("/app-api/check")
OAuth2AccessTokenCheckRespDTO checkAccessToken(@RequestParam("accessToken") String accessToken);
/**
* 移除访问令牌
@@ -35,6 +41,7 @@ public interface OAuth2TokenApi {
* @param accessToken 访问令牌
* @return 访问令牌的信息
*/
@GetMapping("/tmp2")
OAuth2AccessTokenRespDTO removeAccessToken(String accessToken);
/**
@@ -44,6 +51,8 @@ public interface OAuth2TokenApi {
* @param clientId 客户端编号
* @return 访问令牌的信息
*/
OAuth2AccessTokenRespDTO refreshAccessToken(String refreshToken, String clientId);
@GetMapping("/tmp3")
OAuth2AccessTokenRespDTO refreshAccessToken(@RequestParam("refreshToken") String refreshToken,
@RequestParam("clientId") String clientId);
}