Skip to content

Commit f5db372

Browse files
authored
docs(auth): include OAuth documentation for 1.8.0 (#824)
1 parent 0c903b3 commit f5db372

File tree

4 files changed

+127
-19
lines changed

4 files changed

+127
-19
lines changed

i18n/zh-CN/docusaurus-plugin-content-docs/version-1.8.0/about/configuration.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Linkis 支持运行在 Intel x86-64 架构的 64 位通用硬件服务器平台
2929
| 16核+ | 32GB+ | SAS | 千兆网卡 | 1+ |
3030

3131
> **注意:**
32-
>
32+
>
3333
> - 以上建议配置为部署 Linkis的最低配置,生产环境强烈推荐使用更高的配置
3434
> - 硬盘大小配置建议 50GB+ ,系统盘和数据盘分开
3535
@@ -92,7 +92,21 @@ Apache Linkis 可以通过参数接入LDAP实现多用户管理,可以在`link
9292

9393
![](./images/ldap.png)
9494

95-
### 2.4 关闭资源检查
95+
### 2.4 OAuth设置
96+
Apache Linkis 可以通过参数接入OAuth实现SSO登录,可以在`linkis-mg-gateway.properties`替换或追加此配置。
97+
98+
| 参数名 | 默认值 | 描述 |
99+
| ------------------------- | ------- | -----------------------------------------------------------|
100+
| wds.linkis.gateway.conf.enable.oauth.auth | false | 是否启用 OAuth 认证 |
101+
| wds.linkis.gateway.auth.oauth.authentication.url | | OAuth 2.0 授权端点 URL,用于获取授权码 |
102+
| wds.linkis.gateway.auth.oauth.exchange.url | | 令牌交换端点 URL,用于将授权码转换为访问令牌 |
103+
| wds.linkis.gateway.auth.oauth.validate.url | | 用户验证端点 URL,用于通过访问令牌获取用户身份信息 |
104+
| wds.linkis.gateway.auth.oauth.validate.field | | 包含用户名的 JSON 响应字段名 |
105+
| wds.linkis.gateway.auth.oauth.client.id | | OAuth 客户端 ID |
106+
| wds.linkis.gateway.auth.oauth.client.secret | | OAuth 客户端密钥 |
107+
| wds.linkis.gateway.auth.oauth.scope | | OAuth 授权范围 |
108+
109+
### 2.5 关闭资源检查
96110
Apache Linkis 提交任务时有时会调试异常,如:资源不足;可以在`linkis-cg-linkismanager.properties`替换或追加此配置。
97111

98112
| 参数名 | 默认值 | 描述 |
@@ -101,7 +115,7 @@ Apache Linkis 提交任务时有时会调试异常,如:资源不足;可以
101115

102116
![](./images/resource-enable.png)
103117

104-
### 2.5 开启引擎调试
118+
### 2.6 开启引擎调试
105119
Apache Linkis EC可以开启调试模式,可以在`linkis-cg-linkismanager.properties`替换或追加此配置。
106120

107121
| 参数名 | 默认值 | 描述 |
@@ -110,7 +124,7 @@ Apache Linkis EC可以开启调试模式,可以在`linkis-cg-linkismanager.pro
110124

111125
![](./images/engine-debug.png)
112126

113-
### 2.6 Hive元数据配置
127+
### 2.7 Hive元数据配置
114128
Apache Linkis 的public-service服务需要读取hive的元数据;可以在`linkis-ps-publicservice.properties`替换或追加此配置。
115129

116130
| 参数名 | 默认值 | 描述 |
@@ -121,7 +135,7 @@ Apache Linkis 的public-service服务需要读取hive的元数据;可以在`li
121135

122136
![](./images/hive-meta.png)
123137

124-
### 2.7 Linkis 数据库配置
138+
### 2.8 Linkis 数据库配置
125139
Apache Linkis 访问默认使用Mysql作为数据存储,可以在`linkis.properties`替换或追加此配置。
126140

127141
| 参数名 | 默认值 | 描述 |
@@ -132,7 +146,7 @@ Apache Linkis 访问默认使用Mysql作为数据存储,可以在`linkis.prope
132146

133147
![](./images/linkis-db.png)
134148

135-
### 2.8 Linkis Session 缓存配置
149+
### 2.9 Linkis Session 缓存配置
136150
Apache Linkis 支持使用redis进行session的共享;可以在`linkis.properties`替换或追加此配置。
137151

138152
| 参数名 | 默认值 | 描述 |
@@ -144,7 +158,7 @@ Apache Linkis 支持使用redis进行session的共享;可以在`linkis.propert
144158

145159
![](./images/redis.png)
146160

147-
### 2.9 Linkis 模块开发配置
161+
### 2.10 Linkis 模块开发配置
148162
Apache Linkis 开发时可通过此参数,自定义加载模块的数据库、Rest接口、实体对象;可以在`linkis-ps-publicservice.properties`进行修改,多个模块之间使用逗号分割。
149163

150164
| 参数名 | 默认值 | 描述 |
@@ -156,7 +170,7 @@ Apache Linkis 开发时可通过此参数,自定义加载模块的数据库、
156170

157171
![](./images/deverlop-conf.png)
158172

159-
### 2.10 Linkis 模块开发配置
173+
### 2.11 Linkis 模块开发配置
160174
Apache Linkis 开发时可通过此参数,自定义加载模块的路由;可以在`linkis.properties`进行修改,多个模块之间使用逗号分割。
161175

162176
| 参数名 | 默认值 | 描述 |
@@ -165,7 +179,7 @@ Apache Linkis 开发时可通过此参数,自定义加载模块的路由;可
165179

166180
![](./images/list-conf.png)
167181

168-
### 2.11 Linkis 文件系统及物料存放路径
182+
### 2.12 Linkis 文件系统及物料存放路径
169183
Apache Linkis 开发时可通过此参数,自定义加载模块的路由;可以在`linkis.properties`进行修改,多个模块之间使用逗号分割。
170184

171185
| 参数名 | 默认值 | 描述 |
@@ -176,4 +190,4 @@ Apache Linkis 开发时可通过此参数,自定义加载模块的路由;可
176190
| wds.linkis.bml.hdfs.prefix | /apps-data | hdfs路径 |
177191
| wds.linkis.bml.local.prefix | /apps-data | 本地路径 |
178192

179-
![](./images/fs-conf.png)
193+
![](./images/fs-conf.png)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: OAuth
3+
sidebar_position: 1
4+
---
5+
> OAuth(Open Authorization)是一个开放标准授权协议,允许第三方应用在用户授权后访问受保护资源,广泛应用于单点登录(SSO)场景。
6+
7+
## 1. 实现逻辑介绍
8+
9+
通过统一的认证处理filter:`org.apache.linkis.server.security.SecurityFilter` 来控制。
10+
11+
1. 授权请求:后端根据配置生成授权链接,前端引导用户跳转至认证服务器
12+
2. 用户授权:用户通过认证后,认证服务器返回授权码
13+
3. 令牌获取:后端用授权码向认证服务器换取访问令牌
14+
4. 资源访问:后端携带令牌访问资源服务器,读取用户信息
15+
16+
17+
## 2. 使用方式
18+
19+
默认兼容 GitHub OAuth 认证接口。
20+
21+
### 2.1 Step 1 配置授权码接口
22+
23+
```properties
24+
wds.linkis.oauth.enable=true
25+
wds.linkis.oauth.url=https://github.com/login/oauth/authorize
26+
wds.linkis.gateway.auth.oauth.exchange.url=https://github.com/login/oauth/access_token
27+
wds.linkis.gateway.auth.oauth.validate.url=https://api.github.com/user
28+
wds.linkis.gateway.auth.oauth.validate.field=login
29+
wds.linkis.gateway.auth.oauth.client.id=YOUR_CLIENT_ID
30+
wds.linkis.gateway.auth.oauth.client.secret=YOUR_CLIENT_SECRET
31+
wds.linkis.gateway.auth.oauth.scope=user
32+
```
33+
如果配置完成,登录页面将会自动显示 OAuth 授权登录按钮。
34+
35+
### 2.2 Step 2 配置授权回调
36+
37+
> [!NOTE]
38+
> 该项需要在授权服务器上配置。
39+
40+
默认回调地址为:`http://{web_host}:{web_port}/login/oauth/callback?code={code}`

versioned_docs/version-1.8.0/about/configuration.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,21 @@ Apache Linkis can access LDAP through parameters to achieve multi-user managemen
9393

9494
![](./images/ldap.png)
9595

96-
### 2.4 Turn off resource checking
96+
### 2.4 OAuth Settings
97+
Apache Linkis can use OAuth to authenticate users, and this configuration can be replaced or added in `linkis-mg-gateway.properties`.
98+
99+
| parameter name | default value | description |
100+
| ------------------------- | ------- | --------------------------------------------------------------|
101+
|wds.linkis.gateway.conf.enable.oauth.auth| false | Whether to enable OAuth authentication |
102+
|wds.linkis.gateway.auth.oauth.authentication.url| | OAuth 2.0 authorization endpoint URL for obtaining authorization code |
103+
|wds.linkis.gateway.auth.oauth.exchange.url| |Token exchange endpoint URL for converting authorization code to access token |
104+
|wds.linkis.gateway.auth.oauth.validate.url| |User validation endpoint URL for retrieving user identity via access token|
105+
|wds.linkis.gateway.auth.oauth.validate.field| |JSON response field name containing username|
106+
|wds.linkis.gateway.auth.oauth.client.id| | OAuth client ID|
107+
|wds.linkis.gateway.auth.oauth.client.secret| | OAuth client secret|
108+
|wds.linkis.gateway.auth.oauth.scope| | OAuth scope|
109+
110+
### 2.5 Turn off resource checking
97111
Apache Linkis sometimes debugs exceptions when submitting tasks, such as: insufficient resources; you can replace or append this configuration in `linkis-cg-linkismanager.properties`.
98112

99113
| parameter name | default value | description |
@@ -102,7 +116,7 @@ Apache Linkis sometimes debugs exceptions when submitting tasks, such as: insuff
102116

103117
![](./images/resource-enable.png)
104118

105-
### 2.5 Enable engine debugging
119+
### 2.6 Enable engine debugging
106120
Apache Linkis EC can enable debugging mode, and this configuration can be replaced or added in `linkis-cg-linkismanager.properties`.
107121

108122
| parameter name | default value | description |
@@ -111,7 +125,7 @@ Apache Linkis EC can enable debugging mode, and this configuration can be replac
111125

112126
![](./images/engine-debug.png)
113127

114-
### 2.6 Hive metadata configuration
128+
### 2.7 Hive metadata configuration
115129
The public-service service of Apache Linkis needs to read hive metadata; this configuration can be replaced or appended in `linkis-ps-publicservice.properties`.
116130

117131
| parameter name | default value | description |
@@ -122,7 +136,7 @@ The public-service service of Apache Linkis needs to read hive metadata; this co
122136

123137
![](./images/hive-meta.png)
124138

125-
### 2.7 Linkis database configuration
139+
### 2.8 Linkis database configuration
126140
Apache Linkis access uses Mysql as data storage by default, you can replace or append this configuration in `linkis.properties`.
127141

128142
| parameter name | default value | description |
@@ -133,7 +147,7 @@ Apache Linkis access uses Mysql as data storage by default, you can replace or a
133147

134148
![](./images/linkis-db.png)
135149

136-
### 2.8 Linkis Session cache configuration
150+
### 2.9 Linkis Session cache configuration
137151
Apache Linkis supports using redis for session sharing; this configuration can be replaced or appended in `linkis.properties`.
138152

139153
| parameter name | default value | description |
@@ -145,7 +159,7 @@ Apache Linkis supports using redis for session sharing; this configuration can b
145159

146160
![](./images/redis.png)
147161

148-
### 2.9 Linkis module development configuration
162+
### 2.10 Linkis module development configuration
149163
When developing Apache Linkis, you can use this parameter to customize the database, Rest interface, and entity objects of the loading module; you can modify it in `linkis-ps-publicservice.properties`, and use commas to separate multiple modules.
150164

151165
| parameter name | default value | description |
@@ -157,7 +171,7 @@ When developing Apache Linkis, you can use this parameter to customize the datab
157171

158172
![](./images/deverlop-conf.png)
159173

160-
### 2.10 Linkis module development configuration
174+
### 2.11 Linkis module development configuration
161175
This parameter can be used to customize the route of loading modules during Apache Linkis development; it can be modified in `linkis.properties`, and commas are used to separate multiple modules.
162176

163177
| parameter name | default value | description |
@@ -166,7 +180,7 @@ This parameter can be used to customize the route of loading modules during Apac
166180

167181
![](./images/list-conf.png)
168182

169-
### 2.11 Linkis file system and material storage path
183+
### 2.12 Linkis file system and material storage path
170184
This parameter can be used to customize the route of loading modules during Apache Linkis development; it can be modified in `linkis.properties`, and commas are used to separate multiple modules.
171185

172186
| parameter name | default value | description |
@@ -177,4 +191,4 @@ This parameter can be used to customize the route of loading modules during Apac
177191
| wds.linkis.bml.hdfs.prefix | /apps-data | hdfs path |
178192
| wds.linkis.bml.local.prefix | /apps-data | local path |
179193

180-
![](./images/fs-conf.png)
194+
![](./images/fs-conf.png)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: OAuth
3+
sidebar_position: 1
4+
---
5+
> OAuth (Open Authorization) is an open standard authorization protocol that allows third-party applications to access protected resources after user authorization, widely used in Single Sign-On (SSO) scenarios.
6+
7+
## 1. Implementation Logic
8+
9+
Controlled through a unified authentication filter: `org.apache.linkis.server.security.SecurityFilter`.
10+
11+
1. Authorization Request: Backend generates authorization link based on configuration, frontend redirects user to authentication server
12+
2. User Authorization: After user authentication, authentication server returns authorization code
13+
3. Token Acquisition: Backend exchanges authorization code for access token with authentication server
14+
4. Resource Access: Backend accesses resource server with token to retrieve user information
15+
16+
## 2. Usage
17+
18+
Default compatibility with GitHub OAuth authentication interface.
19+
20+
### 2.1 Step 1 Configure Authorization Code Interface
21+
22+
```properties
23+
wds.linkis.oauth.enable=true
24+
wds.linkis.oauth.url=https://github.com/login/oauth/authorize
25+
wds.linkis.gateway.auth.oauth.exchange.url=https://github.com/login/oauth/access_token
26+
wds.linkis.gateway.auth.oauth.validate.url=https://api.github.com/user
27+
wds.linkis.gateway.auth.oauth.validate.field=login
28+
wds.linkis.gateway.auth.oauth.client.id=YOUR_CLIENT_ID
29+
wds.linkis.gateway.auth.oauth.client.secret=YOUR_CLIENT_SECRET
30+
wds.linkis.gateway.auth.oauth.scope=user
31+
```
32+
33+
If configuration is complete, the OAuth login button will automatically appear on the login page.
34+
35+
### 2.2 Step 2 Configure Authorization Callback
36+
37+
> [!NOTE]
38+
> This needs to be configured on the authorization server.
39+
40+
Default callback address: `http://{web_host}:{web_port}/login/oauth/callback?code={code}`

0 commit comments

Comments
 (0)