From 215383f78ecbec5f7861fc24f6566855afd7fcff Mon Sep 17 00:00:00 2001 From: zhanghui <18516865802@163.com> Date: Tue, 12 Apr 2022 08:31:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel-d-sso/README.md | 3 + kernel-d-sso/pom.xml | 35 +++++++++++ kernel-d-sso/sso-api/README.md | 1 + kernel-d-sso/sso-api/pom.xml | 44 +++++++++++++ .../roses/kernel/sso/api/SsoInfoApi.java | 36 +++++++++++ .../sso/api/constants/SsoConstants.java | 44 +++++++++++++ .../kernel/sso/api/context/SsoContext.java | 36 +++++++++++ .../sso/api/exception/SsoException.java | 48 ++++++++++++++ .../api/exception/enums/SsoExceptionEnum.java | 62 +++++++++++++++++++ kernel-d-sso/sso-business-weaver/README.md | 1 + kernel-d-sso/sso-business-weaver/pom.xml | 59 ++++++++++++++++++ .../controller/WeaverSsoController.java | 40 ++++++++++++ .../sso-spring-boot-starter/README.md | 1 + kernel-d-sso/sso-spring-boot-starter/pom.xml | 28 +++++++++ .../sso/starter/GunsSsoAutoConfiguration.java | 37 +++++++++++ .../main/resources/META-INF/spring.factories | 2 + pom.xml | 3 + 17 files changed, 480 insertions(+) create mode 100644 kernel-d-sso/README.md create mode 100644 kernel-d-sso/pom.xml create mode 100644 kernel-d-sso/sso-api/README.md create mode 100644 kernel-d-sso/sso-api/pom.xml create mode 100644 kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/SsoInfoApi.java create mode 100644 kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/constants/SsoConstants.java create mode 100644 kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/context/SsoContext.java create mode 100644 kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/SsoException.java create mode 100644 kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/enums/SsoExceptionEnum.java create mode 100644 kernel-d-sso/sso-business-weaver/README.md create mode 100644 kernel-d-sso/sso-business-weaver/pom.xml create mode 100644 kernel-d-sso/sso-business-weaver/src/main/java/cn/stylefeng/roses/kernel/sso/modular/controller/WeaverSsoController.java create mode 100644 kernel-d-sso/sso-spring-boot-starter/README.md create mode 100644 kernel-d-sso/sso-spring-boot-starter/pom.xml create mode 100644 kernel-d-sso/sso-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/sso/starter/GunsSsoAutoConfiguration.java create mode 100644 kernel-d-sso/sso-spring-boot-starter/src/main/resources/META-INF/spring.factories diff --git a/kernel-d-sso/README.md b/kernel-d-sso/README.md new file mode 100644 index 000000000..b0f79a10e --- /dev/null +++ b/kernel-d-sso/README.md @@ -0,0 +1,3 @@ +第三方单点集成模块 + +实现与泛微OA单点集成 \ No newline at end of file diff --git a/kernel-d-sso/pom.xml b/kernel-d-sso/pom.xml new file mode 100644 index 000000000..b35256492 --- /dev/null +++ b/kernel-d-sso/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + cn.stylefeng.roses + roses-kernel + 7.2.2 + ../pom.xml + + + kernel-d-sso + + pom + + + sso-api + sso-business-weaver + sso-spring-boot-starter + + + + + + + cn.stylefeng.roses + kernel-a-rule + ${roses.version} + + + + + diff --git a/kernel-d-sso/sso-api/README.md b/kernel-d-sso/sso-api/README.md new file mode 100644 index 000000000..c2123719a --- /dev/null +++ b/kernel-d-sso/sso-api/README.md @@ -0,0 +1 @@ +第三方单点登录管理api模块 \ No newline at end of file diff --git a/kernel-d-sso/sso-api/pom.xml b/kernel-d-sso/sso-api/pom.xml new file mode 100644 index 000000000..fb9a70845 --- /dev/null +++ b/kernel-d-sso/sso-api/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-sso + 7.2.2 + ../pom.xml + + + sso-api + + jar + + + + + + cn.stylefeng.roses + validator-api + ${roses.version} + + + + + cn.stylefeng.roses + config-api + ${roses.version} + + + + + + javax.servlet + javax.servlet-api + provided + + + + + diff --git a/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/SsoInfoApi.java b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/SsoInfoApi.java new file mode 100644 index 000000000..789d26801 --- /dev/null +++ b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/SsoInfoApi.java @@ -0,0 +1,36 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.api; + +/** + * 第三方单点登录模块的API + * + * @author zhanghui + * @date 2022/4/11 17:20 + */ +public interface SsoInfoApi { + + +} diff --git a/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/constants/SsoConstants.java b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/constants/SsoConstants.java new file mode 100644 index 000000000..66f3910b9 --- /dev/null +++ b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/constants/SsoConstants.java @@ -0,0 +1,44 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.api.constants; + +/** + * 第三方单点登录模块的常量 + * + * @author zhanghui + * @date 2022/4/11 17:18 + */ +public interface SsoConstants { + + /** + * 文件模块的名称 + */ + String SSO_MODULE_NAME = "kernel-d-sso"; + + /** + * 异常枚举的步进值 + */ + String SSO_EXCEPTION_STEP_CODE = "09"; +} diff --git a/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/context/SsoContext.java b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/context/SsoContext.java new file mode 100644 index 000000000..094e0c820 --- /dev/null +++ b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/context/SsoContext.java @@ -0,0 +1,36 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.api.context; + +/** + * 第三方sso操作api的上下文 + * + * @author zhanghui + * @date 2022/4/11 17:18 + */ +public class SsoContext { + + +} diff --git a/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/SsoException.java b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/SsoException.java new file mode 100644 index 000000000..406003aba --- /dev/null +++ b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/SsoException.java @@ -0,0 +1,48 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.api.exception; + +import cn.hutool.core.util.StrUtil; +import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; +import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; +import cn.stylefeng.roses.kernel.sso.api.constants.SsoConstants; + +/** + * 第三方单点登录模块的异常 + * + * @author zhanghui + * @date 2022/4/11 17:20 + */ +public class SsoException extends ServiceException { + + public SsoException(AbstractExceptionEnum exception) { + super(SsoConstants.SSO_MODULE_NAME, exception); + } + + public SsoException(AbstractExceptionEnum exception, Object... params) { + super(SsoConstants.SSO_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params)); + } + +} diff --git a/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/enums/SsoExceptionEnum.java b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/enums/SsoExceptionEnum.java new file mode 100644 index 000000000..6b2d582fb --- /dev/null +++ b/kernel-d-sso/sso-api/src/main/java/cn/stylefeng/roses/kernel/sso/api/exception/enums/SsoExceptionEnum.java @@ -0,0 +1,62 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.api.exception.enums; + +import cn.stylefeng.roses.kernel.sso.api.constants.SsoConstants; +import cn.stylefeng.roses.kernel.rule.constants.RuleConstants; +import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; +import lombok.Getter; + +/** + * 第三方单点登录模块相关的异常枚举 + * + * @author zhanghui + * @date 2022/4/11 17:19 + */ +@Getter +public enum SsoExceptionEnum implements AbstractExceptionEnum { + + /** + * 演示环境无法操作 + */ + DEMO_OPERATE(RuleConstants.BUSINESS_ERROR_TYPE_CODE + SsoConstants.SSO_EXCEPTION_STEP_CODE + "01", "错误实例!"); + + + /** + * 错误编码 + */ + private final String errorCode; + + /** + * 提示用户信息 + */ + private final String userTip; + + SsoExceptionEnum(String errorCode, String userTip) { + this.errorCode = errorCode; + this.userTip = userTip; + } + +} diff --git a/kernel-d-sso/sso-business-weaver/README.md b/kernel-d-sso/sso-business-weaver/README.md new file mode 100644 index 000000000..9dabf9650 --- /dev/null +++ b/kernel-d-sso/sso-business-weaver/README.md @@ -0,0 +1 @@ +泛微第三方单点登录管理模块,实现与泛微的单点的接通。 \ No newline at end of file diff --git a/kernel-d-sso/sso-business-weaver/pom.xml b/kernel-d-sso/sso-business-weaver/pom.xml new file mode 100644 index 000000000..ecfbbf332 --- /dev/null +++ b/kernel-d-sso/sso-business-weaver/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-sso + 7.2.2 + ../pom.xml + + + sso-business-weaver + + jar + + + + + + cn.stylefeng.roses + sso-api + ${roses.version} + + + + + + cn.stylefeng.roses + scanner-api + ${roses.version} + + + + + + cn.stylefeng.roses + validator-api + ${roses.version} + + + + + + cn.stylefeng.roses + db-sdk-mp + ${roses.version} + + + + + org.springframework.boot + spring-boot-starter-web + + + + + diff --git a/kernel-d-sso/sso-business-weaver/src/main/java/cn/stylefeng/roses/kernel/sso/modular/controller/WeaverSsoController.java b/kernel-d-sso/sso-business-weaver/src/main/java/cn/stylefeng/roses/kernel/sso/modular/controller/WeaverSsoController.java new file mode 100644 index 000000000..e7fa6f74b --- /dev/null +++ b/kernel-d-sso/sso-business-weaver/src/main/java/cn/stylefeng/roses/kernel/sso/modular/controller/WeaverSsoController.java @@ -0,0 +1,40 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.modular.controller; + +import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; +import org.springframework.web.bind.annotation.RestController; + +/** + * 泛微单点登录控制器 + * + * @author zhanghui + * @date 2022/4/11 17:21 + */ +@RestController +@ApiResource(name = "文件信息相关接口") +public class WeaverSsoController { + +} diff --git a/kernel-d-sso/sso-spring-boot-starter/README.md b/kernel-d-sso/sso-spring-boot-starter/README.md new file mode 100644 index 000000000..75e7e9deb --- /dev/null +++ b/kernel-d-sso/sso-spring-boot-starter/README.md @@ -0,0 +1 @@ +泛微第三方单点登录的spring boot自动加载模块 \ No newline at end of file diff --git a/kernel-d-sso/sso-spring-boot-starter/pom.xml b/kernel-d-sso/sso-spring-boot-starter/pom.xml new file mode 100644 index 000000000..557a4aaeb --- /dev/null +++ b/kernel-d-sso/sso-spring-boot-starter/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + + cn.stylefeng.roses + kernel-d-sso + 7.2.2 + ../pom.xml + + + sso-spring-boot-starter + + jar + + + + + + cn.stylefeng.roses + sso-business-weaver + ${roses.version} + + + + diff --git a/kernel-d-sso/sso-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/sso/starter/GunsSsoAutoConfiguration.java b/kernel-d-sso/sso-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/sso/starter/GunsSsoAutoConfiguration.java new file mode 100644 index 000000000..60e3d1c9b --- /dev/null +++ b/kernel-d-sso/sso-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/sso/starter/GunsSsoAutoConfiguration.java @@ -0,0 +1,37 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sso.starter; + +import org.springframework.context.annotation.Configuration; + +/** + * 第三方单点登录自动配置 + * + * @author zhanghui + * @date 2022/4/11 17:34 + */ +@Configuration +public class GunsSsoAutoConfiguration { +} diff --git a/kernel-d-sso/sso-spring-boot-starter/src/main/resources/META-INF/spring.factories b/kernel-d-sso/sso-spring-boot-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..914afaa73 --- /dev/null +++ b/kernel-d-sso/sso-spring-boot-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + cn.stylefeng.roses.kernel.file.starter.GunsSsoAutoConfiguration \ No newline at end of file diff --git a/pom.xml b/pom.xml index ab25ddb55..948d33726 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,9 @@ kernel-s-migration + + kernel-d-sso +