Commit Graph

2157 Commits (de493ccb2c16e0bb6a36f5bd75eca7584fba479e)

Author SHA1 Message Date
guqing de493ccb2c
feat: add plugin setting support (#2238)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
新增插件设置,允许通过 Setting 自定义模型生成表单并收集其值为 ConfigMap
插件可以通过注入 SettingFetcher 来获取值并使用它,例如:
```java
Sns sns = settingFetcher.getGroupForObject("sns", Sns.class);
```
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
None
```
2022-07-12 14:57:08 +00:00
guqing abe29c12bf
feat: add configmap extension (#2232)
* feat: add configmap extension
2022-07-12 15:31:29 +08:00
John Niang 5953d2201d
Refactor CICD for Halo next (#2236) 2022-07-12 11:01:00 +08:00
Ryan Wang c97804780b
refactor: configure the api request to allow credentials and X-XSRF-TOKEN,COOKIE headers (#2227)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-08 09:44:13 +00:00
guqing 3e8f8b8789
feat: add plugin reconciler (#2221)
* feat: add plugin reconciler

* feat: add unit test case
2022-07-08 07:08:13 +00:00
John Niang 3f7cb58370
Add support for custom endpoints (#2223)
* Support to add custom endpoints

Signed-off-by: johnniang <johnniang@fastmail.com>

* Update docs/developer-guide/custom-endpoint.md

Co-authored-by: guqing <38999863+guqing@users.noreply.github.com>

Co-authored-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: guqing <38999863+guqing@users.noreply.github.com>
2022-07-08 04:40:13 +00:00
guqing 73d43cae64
refactor: JSON serialize exception (#2222) 2022-07-07 09:32:14 +00:00
John Niang 2afe19f1b9
Add rolebinding reconciler to reset role names of users (#2217)
* Add rolebinding reconciler to reset role names of users

Signed-off-by: johnniang <johnniang@fastmail.com>

* Add @Bean annotations on roleBindingController

* Fix errors complained by unneccesary catch

Signed-off-by: johnniang <johnniang@fastmail.com>
2022-07-07 03:36:10 +00:00
guqing f62d089237
feat: add role reconciler (#2212)
* feat: add role reconciler

* refactor: get role by name

* refactor: reconcile

* refactor: reconciler

* fix: test
2022-07-06 08:40:12 +00:00
guqing f7945081a5
refactor: plugin custom api generate rules (#2211)
* refactor: plugin custom api generate rules

* refactor: boolean convert

* fix: unit test
2022-07-05 07:00:12 +00:00
John Niang 27435a1aeb
Implement Extension reconciliation mechanism (#2204) 2022-07-04 03:14:24 +00:00
guqing d7cfe4c4a5
refactor: Unstructured loading opportunity for plugin (#2191)
* refactor: Unstructured loading opportunity for plugin

* refactor: gvk
2022-06-27 07:14:10 +00:00
John Niang 61d2169a51
Add additional method to fetch Extension by GVK and name (#2190) 2022-06-26 16:04:09 +00:00
guqing c0758f32d1
refactor: plugin configuration loading to adapt to plugin development mode (#2183)
* refactor: plugin configuration loading to adapt to plugin development mode

* refactor: extension locations

* refactor: plugin labels

* fix: unit test
2022-06-23 09:56:26 +00:00
guqing 273ffaad48
feat: add plugin status manage (#2177)
* feat: add plugin status manage

* feat: add plugin state changed listener

* refactor: plugin status

* refactor: plugin
2022-06-23 03:08:24 +00:00
John Niang c24df6fb05
Refine Swagger document for Extension APIs (#2180) 2022-06-22 04:36:21 +00:00
John Niang ac7a3c86c8
Configure CORS for API endpoints (#2175) 2022-06-21 11:06:20 +00:00
John Niang d556787b3a
Add update and delete handlers for Extensions (#2172) 2022-06-21 11:04:21 +00:00
guqing b9e5ed2f4c
feat: add shared application context for plugin (#2174)
* feat: add shared application context for plugin

* chore: remove todo notes

* fix: router function composite
2022-06-21 07:34:25 +00:00
guqing 7cd1282ad3
feat: add request mapping handler mapping for plugin (#2161)
* feat: add requet mapping handler mapping for plugin

* fix: request info resolve

* fix: test code style

* refactor: plugin api version resolve

* fix: merge conflicts
2022-06-21 03:22:24 +00:00
guqing 89eeccd99c
fix: locale for unit test of json extension converter (#2170) 2022-06-20 15:18:28 +00:00
John Niang f5d629d2bf
Add user support for authentication and authorization (#2163)
* Move role and rolebinding extensions into core package

* Add UserExtensionUserDetailService to find user and update password

* Rename DefaultUserDetailService

* Fix test errors

* Add SuperAdminInitializer to initialize first user

* Add unit tests for DefaultUserDetailService and UserService

* Add test for verifying SuperAdminInitializer

* Fix unstable test due to database reusability

Signed-off-by: johnniang <johnniang@fastmail.com>
2022-06-20 03:26:18 +00:00
John Niang e52db6859f
Add feature to generate APIs for schemes automatically (#2158)
* Add ExtensionEndpointInstaller

* Refactor Schemes with SchemeManager

* Add some unit tests

1. Add ExtensionCompositeRouterFunctionTest
2. Add ExtensionConfigurationTest
3. Refactor Unstructured
4. Fix bad ObjectMapper in Json converter.

* Fix bad scheme registration
2022-06-16 03:10:14 +00:00
guqing fcbf0031a4
feat: plugin supports multiple ways of specifying licenses (#2152)
* feat: plugin supports multiple ways of specifying licenses

* feat: add unit test case for deserialize license
2022-06-15 15:36:12 +00:00
guqing 83d668b0a9
feat: add plugin unstructured resource loader (#2154)
* feat: add plugin unstructured resource loader

* feat: add test unit case
2022-06-14 15:38:12 +00:00
guqing 6bbaa9aeba
feat: add reverse proxy router registry for plugin by reverse proxy rules (#2151)
* feat: add reverse proxy router registry for plugin by reverse proxy rules

* Update src/main/java/run/halo/app/plugin/resources/ReverseProxyRouterFunctionFactory.java

Co-authored-by: John Niang <johnniang@fastmail.com>

* refactor: merge stream operation

* refactor: plugin composite router function

* feat: add unit test case

Co-authored-by: John Niang <johnniang@fastmail.com>
2022-06-14 10:58:21 +00:00
guqing a2f49c60bc
feat: add plugin life cycle management (#2134)
* feat: add plugin life cycle management

* refactor: plugin lifecycle endpoint mapping
2022-06-13 02:36:11 +00:00
Halo Dev Bot 95c6caaca1
docs: add CODE_OF_CONDUCT.md (#2150)
Co-authored-by: Ryan Wang <i@ryanc.cc>
2022-06-12 08:10:12 +00:00
John Niang a956758a2f
Overwrite Jackson2Json decoder and encoder (#2145) 2022-06-09 08:04:13 +00:00
John Niang 02a7143fe5
Enable CSRF token in Set-Cookie header (#2144) 2022-06-09 02:30:13 +00:00
guqing b3b13bc820
feat: add yaml descriptor finder for plugin (#2132)
* feat: add yaml plugin descriptor finder

* refactor: json assert

* refactor: plugin descriptor finder

* refactor: yaml plguin finder

* refactor: plugin dependencies
2022-06-07 06:32:12 +00:00
John Niang 1024f71635
Replace webmvc with webflux (#2138)
* Replace webmvc to webflux

Signed-off-by: johnniang <johnniang@fastmail.com>

* Remove jetty dependency

Signed-off-by: johnniang <johnniang@fastmail.com>

* Refactor authentication module

* Refactor authentication module

* Migrate authorization module

* Refactor Login components

* Fix broken imports

* Upgrade springdoc version

* Refine security matcher using pathMatchers utility
2022-06-07 02:20:12 +00:00
guqing 19db04c430
refactor: policy rule constructor to avoid null values (#2131)
* refactor: policy rule constructor to avoid null values

* fix: unit test case
2022-06-02 02:52:10 +00:00
guqing 2c057f4fe1
feat: add plugin implementation (#2128) 2022-05-31 04:06:10 +00:00
guqing f4a943e45a
refactor: rule resolver and role binding lister (#2119) 2022-05-30 09:08:09 +00:00
guqing 9a05942bc4
feat: add yaml unstructured loader (#2122) 2022-05-28 09:44:08 +00:00
guqing 3c856d04af
feat: add personal access token authentication mechanism (#2116)
* feat: add personal access token authentication

* fix: merge conflicts

* refactor: remove base62 codec

* refactor: remove deprecated method

* feat: add base64 test

* chore: add todo for test only methods
2022-05-27 06:26:37 +00:00
John Niang b5d7f194ef
Create unstructured Extension which can store any Extensions (#2111)
* Extract ExtensionOperator and MetadataOperator

* Move groupVersionKind methods up to ExtensionOperator interface

* Add Unstructured Extension for generic Extension

* Refine mapping of GVK and Scheme

* Add two compatible methods
2022-05-26 08:38:10 +00:00
guqing 0f4ae08fd8
feat: add logout handler (#2110)
* feat: add logout handler

* chore: delete unused code

* fix: merge conflicts
2022-05-25 09:58:10 +00:00
guqing c5df6d3dbb
feat: add default role binding lister and role getter (#2108)
* feat: add default role binding lister and role getter

* feat: add initial capacity for role binding list
2022-05-25 07:52:10 +00:00
John Niang 9990fdd086
Upgrade to Spring Boot 3.0.0-M3 (#2102)
Please see https://github.com/spring-projects/spring-boot/releases/tag/v3.0.0-M3
2022-05-20 03:35:34 +00:00
John Niang 5f9daf4735
Add JSON schema generator and validator (#2093)
Only validate the JSON schema when saving Extension into database.
2022-05-17 16:06:12 +00:00
John Niang 264f9e39cb
Add support for Extension mechanism (#2086)
* Add support for Extension mechanism

1. Add ExtensionStore
2. Add Extension
3. Add Scheme

* Add more unit tests

* Fix checkstyle violations

* Remove unused import
2022-05-17 10:36:13 +00:00
guqing be2c0654a2
chore: add checkstyle rule (#2091)
* feat: add unused imports checkstyle rule

* feat: add java doc style rule

* fix: check style
2022-05-17 06:46:11 +00:00
John Niang 3cf2f9d7e1
Add support for API documentation (#2082) 2022-05-11 08:06:11 +00:00
guqing b4e9b54ffe
refactor: remove authorization filter and replace it with the RequestInfoAuthorizationManager (#2081) 2022-05-11 02:26:11 +00:00
John Niang 6db4f1105a
Upgrade Spring Boot to 3.0.0-M2 (#2071)
from 3.0.0-M1 to 3.0.0-M2, please refer to https://github.com/spring-projects/spring-boot/releases/tag/v3.0.0-M2
2022-05-06 09:56:13 +00:00
guqing d9bccdb5e1
feat: Add rule resolver and authorization filter (#1904)
* feat: Add request info resolver and evaluation

* feat: Add attributes record

* feat: Add rule resolver and authorization filter

* feat: Add authorization intergation test case

* chore: add todo for only testing class
2022-04-29 06:39:08 +00:00
guqing 9a0dc50653
feat: Add Principal attribute to authorizationBuilder when password authenticate successfully (#1878) 2022-04-22 09:36:11 +00:00
guqing a7b9433120
feat: Add bearer token filter config for authentication (#1876) 2022-04-22 07:36:11 +00:00