From 4811b18917a7104e2b1cdb29ea8bad774d4b7b51 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Wed, 10 May 2023 11:11:36 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.6.0=E3=80=91=E3=80=90=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E6=94=B9=E9=80=A0=E3=80=91=E7=A7=BB=E9=99=A4=E9=BB=91?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel-d-security/pom.xml | 1 - .../security-sdk-black-white/README.md | 1 - .../security-sdk-black-white/pom.xml | 45 ------------ .../security/blackwhite/BlackListService.java | 68 ------------------- .../security/blackwhite/WhiteListService.java | 68 ------------------- .../cache/BlackListMemoryCache.java | 48 ------------- .../blackwhite/cache/BlackListRedisCache.java | 49 ------------- .../cache/WhiteListMemoryCache.java | 48 ------------- .../blackwhite/cache/WhiteListRedisCache.java | 49 ------------- .../security-spring-boot-starter/pom.xml | 7 -- 10 files changed, 384 deletions(-) delete mode 100644 kernel-d-security/security-sdk-black-white/README.md delete mode 100644 kernel-d-security/security-sdk-black-white/pom.xml delete mode 100644 kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/BlackListService.java delete mode 100644 kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/WhiteListService.java delete mode 100644 kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListMemoryCache.java delete mode 100644 kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListRedisCache.java delete mode 100644 kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListMemoryCache.java delete mode 100644 kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListRedisCache.java diff --git a/kernel-d-security/pom.xml b/kernel-d-security/pom.xml index 679127869..6d9d51187 100644 --- a/kernel-d-security/pom.xml +++ b/kernel-d-security/pom.xml @@ -17,7 +17,6 @@ security-api - security-sdk-black-white security-sdk-captcha security-sdk-clear-threadlocal security-sdk-cors diff --git a/kernel-d-security/security-sdk-black-white/README.md b/kernel-d-security/security-sdk-black-white/README.md deleted file mode 100644 index c303d92a1..000000000 --- a/kernel-d-security/security-sdk-black-white/README.md +++ /dev/null @@ -1 +0,0 @@ -黑白名单的校验模块 \ No newline at end of file diff --git a/kernel-d-security/security-sdk-black-white/pom.xml b/kernel-d-security/security-sdk-black-white/pom.xml deleted file mode 100644 index c1616bfa6..000000000 --- a/kernel-d-security/security-sdk-black-white/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-security - 7.6.0 - ../pom.xml - - - security-sdk-black-white - - - - - - cn.stylefeng.roses - security-api - ${roses.version} - - - - - cn.stylefeng.roses - cache-api - ${roses.version} - - - cn.stylefeng.roses - cache-sdk-memory - ${roses.version} - true - - - cn.stylefeng.roses - cache-sdk-redis - ${roses.version} - true - - - - diff --git a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/BlackListService.java b/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/BlackListService.java deleted file mode 100644 index 59c086739..000000000 --- a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/BlackListService.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.security.blackwhite; - -import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi; -import cn.stylefeng.roses.kernel.security.api.BlackListApi; - -import java.util.Collection; - -/** - * 黑名单的实现 - *

- * 黑名单的数据会在访问资源时被限制 - * - * @author fengshuonan - * @since 2020/11/20 15:52 - */ -public class BlackListService implements BlackListApi { - - private final CacheOperatorApi cacheOperatorApi; - - public BlackListService(CacheOperatorApi cacheOperatorApi) { - this.cacheOperatorApi = cacheOperatorApi; - } - - @Override - public void addBlackItem(String content) { - cacheOperatorApi.put(content, content); - } - - @Override - public void removeBlackItem(String content) { - cacheOperatorApi.remove(content); - } - - @Override - public Collection getBlackList() { - return cacheOperatorApi.getAllKeys(); - } - - @Override - public boolean contains(String content) { - return cacheOperatorApi.contains(content); - } - -} diff --git a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/WhiteListService.java b/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/WhiteListService.java deleted file mode 100644 index 76353c482..000000000 --- a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/WhiteListService.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.security.blackwhite; - -import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi; -import cn.stylefeng.roses.kernel.security.api.WhiteListApi; - -import java.util.Collection; - -/** - * 白名单的实现 - *

- * 白名单的数据在访问资源时不受限 - * - * @author fengshuonan - * @since 2020/11/20 15:53 - */ -public class WhiteListService implements WhiteListApi { - - private final CacheOperatorApi cacheOperatorApi; - - public WhiteListService(CacheOperatorApi cacheOperatorApi) { - this.cacheOperatorApi = cacheOperatorApi; - } - - @Override - public void addWhiteItem(String content) { - cacheOperatorApi.put(content, content); - } - - @Override - public void removeWhiteItem(String content) { - cacheOperatorApi.remove(content); - } - - @Override - public Collection getWhiteList() { - return cacheOperatorApi.getAllKeys(); - } - - @Override - public boolean contains(String content) { - return cacheOperatorApi.contains(content); - } - -} diff --git a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListMemoryCache.java b/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListMemoryCache.java deleted file mode 100644 index fc2e46551..000000000 --- a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListMemoryCache.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.security.blackwhite.cache; - -import cn.hutool.cache.impl.TimedCache; -import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator; -import cn.stylefeng.roses.kernel.security.api.constants.CounterConstants; - -/** - * 黑名单用户的缓存 - * - * @author fengshuonan - * @since 2020/11/20 15:50 - */ -public class BlackListMemoryCache extends AbstractMemoryCacheOperator { - - public BlackListMemoryCache(TimedCache timedCache) { - super(timedCache); - } - - @Override - public String getCommonKeyPrefix() { - return CounterConstants.BLACK_LIST_CACHE_KEY_PREFIX; - } - -} diff --git a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListRedisCache.java b/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListRedisCache.java deleted file mode 100644 index 06e279f56..000000000 --- a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/BlackListRedisCache.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.security.blackwhite.cache; - -import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator; -import cn.stylefeng.roses.kernel.security.api.constants.CounterConstants; -import org.springframework.data.redis.core.RedisTemplate; - - -/** - * 黑名单用户的缓存 - * - * @author fengshuonan - * @since 2020/11/20 15:50 - */ -public class BlackListRedisCache extends AbstractRedisCacheOperator { - - public BlackListRedisCache(RedisTemplate redisTemplate) { - super(redisTemplate); - } - - @Override - public String getCommonKeyPrefix() { - return CounterConstants.BLACK_LIST_CACHE_KEY_PREFIX; - } - -} diff --git a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListMemoryCache.java b/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListMemoryCache.java deleted file mode 100644 index d13d057c8..000000000 --- a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListMemoryCache.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.security.blackwhite.cache; - -import cn.hutool.cache.impl.TimedCache; -import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator; -import cn.stylefeng.roses.kernel.security.api.constants.CounterConstants; - -/** - * 白名单的缓存 - * - * @author fengshuonan - * @since 2020/11/15 15:26 - */ -public class WhiteListMemoryCache extends AbstractMemoryCacheOperator { - - public WhiteListMemoryCache(TimedCache timedCache) { - super(timedCache); - } - - @Override - public String getCommonKeyPrefix() { - return CounterConstants.WHITE_LIST_CACHE_KEY_PREFIX; - } - -} diff --git a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListRedisCache.java b/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListRedisCache.java deleted file mode 100644 index fc681824c..000000000 --- a/kernel-d-security/security-sdk-black-white/src/main/java/cn/stylefeng/roses/kernel/security/blackwhite/cache/WhiteListRedisCache.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.security.blackwhite.cache; - -import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator; -import cn.stylefeng.roses.kernel.security.api.constants.CounterConstants; -import org.springframework.data.redis.core.RedisTemplate; - - -/** - * 白名单的缓存 - * - * @author fengshuonan - * @since 2020/11/15 15:26 - */ -public class WhiteListRedisCache extends AbstractRedisCacheOperator { - - public WhiteListRedisCache(RedisTemplate redisTemplate) { - super(redisTemplate); - } - - @Override - public String getCommonKeyPrefix() { - return CounterConstants.WHITE_LIST_CACHE_KEY_PREFIX; - } - -} diff --git a/kernel-d-security/security-spring-boot-starter/pom.xml b/kernel-d-security/security-spring-boot-starter/pom.xml index f9163a3f1..4121ba77a 100644 --- a/kernel-d-security/security-spring-boot-starter/pom.xml +++ b/kernel-d-security/security-spring-boot-starter/pom.xml @@ -45,13 +45,6 @@ ${roses.version} - - - cn.stylefeng.roses - security-sdk-black-white - ${roses.version} - - cn.stylefeng.roses