From 2a031d7b44c4d9da99c66e853a00aa2c716231d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 15 Feb 2023 13:06:11 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20SaToken=20?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=89=A9=E5=B1=95=E7=B1=BB=20?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=85=8D=E7=BD=AE=E7=B1=BB=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=20=E4=BE=BF=E4=BA=8E=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../satoken/config/SaTokenConfiguration.java | 20 +++++++++++++++++++ ...ot.autoconfigure.AutoConfiguration.imports | 2 -- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-satoken/src/main/java/com/ruoyi/common/satoken/config/SaTokenConfiguration.java b/ruoyi-common/ruoyi-common-satoken/src/main/java/com/ruoyi/common/satoken/config/SaTokenConfiguration.java index 2d1d74c9..2eda704f 100644 --- a/ruoyi-common/ruoyi-common-satoken/src/main/java/com/ruoyi/common/satoken/config/SaTokenConfiguration.java +++ b/ruoyi-common/ruoyi-common-satoken/src/main/java/com/ruoyi/common/satoken/config/SaTokenConfiguration.java @@ -1,7 +1,11 @@ package com.ruoyi.common.satoken.config; +import cn.dev33.satoken.dao.SaTokenDao; import cn.dev33.satoken.jwt.StpLogicJwtForSimple; +import cn.dev33.satoken.stp.StpInterface; import cn.dev33.satoken.stp.StpLogic; +import com.ruoyi.common.satoken.core.dao.PlusSaTokenDao; +import com.ruoyi.common.satoken.core.service.SaPermissionImpl; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.Bean; @@ -18,4 +22,20 @@ public class SaTokenConfiguration { return new StpLogicJwtForSimple(); } + /** + * 权限接口实现(使用bean注入方便用户替换) + */ + @Bean + public StpInterface stpInterface() { + return new SaPermissionImpl(); + } + + /** + * 自定义dao层存储 + */ + @Bean + public SaTokenDao saTokenDao() { + return new PlusSaTokenDao(); + } + } diff --git a/ruoyi-common/ruoyi-common-satoken/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-common/ruoyi-common-satoken/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index ec1ea549..09ce96b9 100644 --- a/ruoyi-common/ruoyi-common-satoken/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/ruoyi-common/ruoyi-common-satoken/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,3 +1 @@ -com.ruoyi.common.satoken.core.dao.PlusSaTokenDao -com.ruoyi.common.satoken.core.service.SaPermissionImpl com.ruoyi.common.satoken.config.SaTokenConfiguration