Skip to content

Commit f11798d

Browse files
committed
feat:新增数据权限鉴权相关 API
1 parent d66c752 commit f11798d

File tree

74 files changed

+2540
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2540
-274
lines changed

src/main/java/cn/authing/sdk/java/client/AuthenticationClient.java

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,66 @@ public LoginTokenRespDto signInByCredentials(SigninByCredentialsDto reqDto) {
11901190
String response = request(config);
11911191
return deserialize(response, LoginTokenRespDto.class);
11921192
}
1193+
/**
1194+
* @summary 使用用户凭证登录
1195+
* @description
1196+
* 此端点为基于直接 API 调用形式的登录端点,适用于你需要自建登录页面的场景。**此端点暂时不支持 MFA、信息补全、首次密码重置等流程,如有需要,请使用 OIDC 标准协议认证端点。**
1197+
*
1198+
*
1199+
* 注意事项:取决于你在 Authing 创建应用时选择的**应用类型**和应用配置的**换取 token 身份验证方式**,在调用此接口时需要对客户端的身份进行不同形式的验证。
1200+
*
1201+
* <details>
1202+
* <summary>点击展开详情</summary>
1203+
*
1204+
* <br>
1205+
*
1206+
* 你可以在 [Authing 控制台](https://console.authing.cn) 的**应用** - **自建应用** - **应用详情** - **应用配置** - **其他设置** - **授权配置**
1207+
* 中找到**换取 token 身份验证方式** 配置项:
1208+
*
1209+
* > 单页 Web 应用和客户端应用隐藏,默认为 `none`,不允许修改;后端应用和标准 Web 应用可以修改此配置项。
1210+
*
1211+
* ![](https://files.authing.co/api-explorer/tokenAuthMethod.jpg)
1212+
*
1213+
* #### 换取 token 身份验证方式为 none 时
1214+
*
1215+
* 调用此接口不需要进行额外操作。
1216+
*
1217+
* #### 换取 token 身份验证方式为 client_secret_post 时
1218+
*
1219+
* 调用此接口时必须在 body 中传递 `client_id` 和 `client_secret` 参数,作为验证客户端身份的条件。其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。
1220+
*
1221+
* #### 换取 token 身份验证方式为 client_secret_basic 时
1222+
*
1223+
* 调用此接口时必须在 HTTP 请求头中携带 `authorization` 请求头,作为验证客户端身份的条件。`authorization` 请求头的格式如下(其中 `client_id` 为应用 ID、`client_secret` 为应用密钥。):
1224+
*
1225+
* ```
1226+
* Basic base64(<client_id>:<client_secret>)
1227+
* ```
1228+
*
1229+
* 结果示例:
1230+
*
1231+
* ```
1232+
* Basic NjA2M2ZiMmYzY3h4eHg2ZGY1NWYzOWViOjJmZTdjODdhODFmODY3eHh4eDAzMjRkZjEyZGFlZGM3
1233+
* ```
1234+
*
1235+
* JS 代码示例:
1236+
*
1237+
* ```js
1238+
* 'Basic ' + Buffer.from(client_id + ':' + client_secret).toString('base64');
1239+
* ```
1240+
*
1241+
* </details>
1242+
*
1243+
*
1244+
**/
1245+
public LoginTokenRespDto signInByCredentials1(SigninByCredentialsDto reqDto) {
1246+
AuthingRequestConfig config = new AuthingRequestConfig();
1247+
config.setUrl("/api/v3/signin");
1248+
config.setBody(reqDto);
1249+
config.setMethod("POST");
1250+
String response = request(config);
1251+
return deserialize(response, LoginTokenRespDto.class);
1252+
}
11931253
/**
11941254
* @summary 使用移动端社会化登录
11951255
* @description
@@ -1800,6 +1860,25 @@ public UserSingleRespDto signUp(SignUpDto reqDto) {
18001860
String response = request(config);
18011861
return deserialize(response, UserSingleRespDto.class);
18021862
}
1863+
/**
1864+
* @summary 注册
1865+
* @description
1866+
* 此端点目前支持以下几种基于的注册方式:
1867+
*
1868+
* 1. 基于密码(PASSWORD):用户名 + 密码,邮箱 + 密码。
1869+
* 2. 基于一次性临时验证码(PASSCODE):手机号 + 验证码,邮箱 + 验证码。你需要先调用发送短信或者发送邮件接口获取验证码。
1870+
*
1871+
* 社会化登录等使用外部身份源“注册”请直接使用**登录**接口,我们会在其第一次登录的时候为其创建一个新账号。
1872+
*
1873+
**/
1874+
public UserSingleRespDto signUp1(SignUpDto reqDto) {
1875+
AuthingRequestConfig config = new AuthingRequestConfig();
1876+
config.setUrl("/api/v3/signup");
1877+
config.setBody(reqDto);
1878+
config.setMethod("POST");
1879+
String response = request(config);
1880+
return deserialize(response, UserSingleRespDto.class);
1881+
}
18031882
/**
18041883
* @summary 解密微信小程序数据
18051884
* @description 解密微信小程序数据
@@ -1872,6 +1951,18 @@ public GetTenantListRespDto getTenantList() {
18721951
String response = request(config);
18731952
return deserialize(response, GetTenantListRespDto.class);
18741953
}
1954+
/**
1955+
* @summary 获取租户列表
1956+
* @description 获取租户列表
1957+
**/
1958+
public GetTenantListRespDto getTenantList1() {
1959+
AuthingRequestConfig config = new AuthingRequestConfig();
1960+
config.setUrl("/api/v3/get-my-tenant-list");
1961+
config.setBody(new Object());
1962+
config.setMethod("GET");
1963+
String response = request(config);
1964+
return deserialize(response, GetTenantListRespDto.class);
1965+
}
18751966
/**
18761967
* @summary 获取角色列表
18771968
* @description 获取角色列表

0 commit comments

Comments
 (0)