Skip to content

Commit 7ca5270

Browse files
authored
feat: support the expansion of other authentication methods (#3520)
#### What type of PR is this? /kind feature /milestone 2.4.0 /area core #### What this PR does / why we need it: 支持扩展其他登录方式: 1. 增加 AdditionalWebFilter 扩展点,插件只需要实现此扩展点完成 Filter 逻辑 2. 增加 DynamicMatcherSecurityWebFilterChain 用于将 `apiFilterChain` 的 `SecurityWebFilterChain` 委托给此类,需要认证的请求都会 DynamicMatcherSecurityWebFilterChain 的过滤器进行处理,所以 `AdditionalWebFilter` 可以通过 order 将扩展的过滤器放到这条链上的任何位置。 3. 将表单登录改为实现扩展点的实现 4. 增加 ExtensionPointDefinition 和 ExtensionDefinition 自定义模型用于对扩展点和扩展进行描述 5. 提供 AuthProvider 自定义模型用于记录支持的登录方式提供商 6. 提供 UserConnection 自定义模型用于将第三方登录账号信息与当前系统账户进行绑定 how to test it? 1. 测试表单登录功能是否正常 2. 测试插件的 plugin-oauth-github 的 PR halo-sigs/plugin-oauth2#3 功能是否正常 #### Which issue(s) this PR fixes: Fixes #3423 #### Does this PR introduce a user-facing change? ```release-note 支持扩展其他的认证方式 ```
1 parent f7eb0cd commit 7ca5270

File tree

66 files changed

+6609
-97
lines changed

Some content is hidden

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

66 files changed

+6609
-97
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ dependencies {
6565
// Spring Security
6666
implementation 'org.springframework.boot:spring-boot-starter-security'
6767
implementation 'org.springframework.security:spring-security-oauth2-jose'
68+
implementation 'org.springframework.security:spring-security-oauth2-client'
6869
implementation 'org.springframework.security:spring-security-oauth2-resource-server'
6970

7071
implementation "org.springdoc:springdoc-openapi-starter-webflux-ui:$springDocOpenAPI"

console/packages/api-client/src/.openapi-generator/FILES

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.npmignore
33
api.ts
44
api/api-console-halo-run-v1alpha1-attachment-api.ts
5+
api/api-console-halo-run-v1alpha1-auth-provider-api.ts
56
api/api-console-halo-run-v1alpha1-comment-api.ts
67
api/api-console-halo-run-v1alpha1-indices-api.ts
78
api/api-console-halo-run-v1alpha1-plugin-api.ts
@@ -14,6 +15,8 @@ api/api-console-halo-run-v1alpha1-user-api.ts
1415
api/api-halo-run-v1alpha1-comment-api.ts
1516
api/api-halo-run-v1alpha1-post-api.ts
1617
api/api-halo-run-v1alpha1-tracker-api.ts
18+
api/auth-halo-run-v1alpha1-auth-provider-api.ts
19+
api/auth-halo-run-v1alpha1-user-connection-api.ts
1720
api/content-halo-run-v1alpha1-category-api.ts
1821
api/content-halo-run-v1alpha1-comment-api.ts
1922
api/content-halo-run-v1alpha1-post-api.ts
@@ -23,6 +26,8 @@ api/content-halo-run-v1alpha1-snapshot-api.ts
2326
api/content-halo-run-v1alpha1-tag-api.ts
2427
api/login-api.ts
2528
api/metrics-halo-run-v1alpha1-counter-api.ts
29+
api/plugin-halo-run-v1alpha1-extension-definition-api.ts
30+
api/plugin-halo-run-v1alpha1-extension-point-definition-api.ts
2631
api/plugin-halo-run-v1alpha1-plugin-api.ts
2732
api/plugin-halo-run-v1alpha1-reverse-proxy-api.ts
2833
api/plugin-halo-run-v1alpha1-search-engine-api.ts
@@ -52,6 +57,9 @@ models/attachment-list.ts
5257
models/attachment-spec.ts
5358
models/attachment-status.ts
5459
models/attachment.ts
60+
models/auth-provider-list.ts
61+
models/auth-provider-spec.ts
62+
models/auth-provider.ts
5563
models/author.ts
5664
models/category-list.ts
5765
models/category-spec.ts
@@ -71,6 +79,7 @@ models/comment-vo.ts
7179
models/comment.ts
7280
models/condition.ts
7381
models/config-map-list.ts
82+
models/config-map-ref.ts
7483
models/config-map.ts
7584
models/content-wrapper.ts
7685
models/content.ts
@@ -82,6 +91,12 @@ models/custom-templates.ts
8291
models/dashboard-stats.ts
8392
models/detailed-user.ts
8493
models/excerpt.ts
94+
models/extension-definition-list.ts
95+
models/extension-definition.ts
96+
models/extension-point-definition-list.ts
97+
models/extension-point-definition.ts
98+
models/extension-point-spec.ts
99+
models/extension-spec.ts
85100
models/extension.ts
86101
models/file-reverse-proxy-provider.ts
87102
models/grant-request.ts
@@ -92,6 +107,7 @@ models/group-status.ts
92107
models/group.ts
93108
models/index.ts
94109
models/license.ts
110+
models/listed-auth-provider.ts
95111
models/listed-comment-list.ts
96112
models/listed-comment.ts
97113
models/listed-post-list.ts
@@ -155,6 +171,7 @@ models/search-engine-spec.ts
155171
models/search-engine.ts
156172
models/setting-form.ts
157173
models/setting-list.ts
174+
models/setting-ref.ts
158175
models/setting-spec.ts
159176
models/setting.ts
160177
models/single-page-list.ts
@@ -176,6 +193,9 @@ models/theme-list.ts
176193
models/theme-spec.ts
177194
models/theme-status.ts
178195
models/theme.ts
196+
models/user-connection-list.ts
197+
models/user-connection-spec.ts
198+
models/user-connection.ts
179199
models/user-list.ts
180200
models/user-permission.ts
181201
models/user-spec.ts

console/packages/api-client/src/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
export * from "./api/api-console-halo-run-v1alpha1-attachment-api";
16+
export * from "./api/api-console-halo-run-v1alpha1-auth-provider-api";
1617
export * from "./api/api-console-halo-run-v1alpha1-comment-api";
1718
export * from "./api/api-console-halo-run-v1alpha1-indices-api";
1819
export * from "./api/api-console-halo-run-v1alpha1-plugin-api";
@@ -25,6 +26,8 @@ export * from "./api/api-console-halo-run-v1alpha1-user-api";
2526
export * from "./api/api-halo-run-v1alpha1-comment-api";
2627
export * from "./api/api-halo-run-v1alpha1-post-api";
2728
export * from "./api/api-halo-run-v1alpha1-tracker-api";
29+
export * from "./api/auth-halo-run-v1alpha1-auth-provider-api";
30+
export * from "./api/auth-halo-run-v1alpha1-user-connection-api";
2831
export * from "./api/content-halo-run-v1alpha1-category-api";
2932
export * from "./api/content-halo-run-v1alpha1-comment-api";
3033
export * from "./api/content-halo-run-v1alpha1-post-api";
@@ -34,6 +37,8 @@ export * from "./api/content-halo-run-v1alpha1-snapshot-api";
3437
export * from "./api/content-halo-run-v1alpha1-tag-api";
3538
export * from "./api/login-api";
3639
export * from "./api/metrics-halo-run-v1alpha1-counter-api";
40+
export * from "./api/plugin-halo-run-v1alpha1-extension-definition-api";
41+
export * from "./api/plugin-halo-run-v1alpha1-extension-point-definition-api";
3742
export * from "./api/plugin-halo-run-v1alpha1-plugin-api";
3843
export * from "./api/plugin-halo-run-v1alpha1-reverse-proxy-api";
3944
export * from "./api/plugin-halo-run-v1alpha1-search-engine-api";

0 commit comments

Comments
 (0)