Commit 08e1c69d10a5c946ab9d32d7d605fe7ffc93c96f
1 parent
41ee2371
【优化】数据脱敏支持 Spring el 表达式,支持根据权限控制脱敏
Showing
24 changed files
with
164 additions
and
0 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java
| @@ -3,11 +3,15 @@ package cn.iocoder.yudao.framework.common.util.spring; | @@ -3,11 +3,15 @@ package cn.iocoder.yudao.framework.common.util.spring; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.map.MapUtil; | 4 | import cn.hutool.core.map.MapUtil; |
| 5 | import cn.hutool.core.util.ArrayUtil; | 5 | import cn.hutool.core.util.ArrayUtil; |
| 6 | +import cn.hutool.core.util.StrUtil; | ||
| 6 | import org.aspectj.lang.JoinPoint; | 7 | import org.aspectj.lang.JoinPoint; |
| 7 | import org.aspectj.lang.reflect.MethodSignature; | 8 | import org.aspectj.lang.reflect.MethodSignature; |
| 9 | +import org.springframework.beans.factory.BeanFactory; | ||
| 10 | +import org.springframework.context.expression.BeanFactoryResolver; | ||
| 8 | import org.springframework.core.DefaultParameterNameDiscoverer; | 11 | import org.springframework.core.DefaultParameterNameDiscoverer; |
| 9 | import org.springframework.core.ParameterNameDiscoverer; | 12 | import org.springframework.core.ParameterNameDiscoverer; |
| 10 | import org.springframework.expression.EvaluationContext; | 13 | import org.springframework.expression.EvaluationContext; |
| 14 | +import org.springframework.expression.Expression; | ||
| 11 | import org.springframework.expression.ExpressionParser; | 15 | import org.springframework.expression.ExpressionParser; |
| 12 | import org.springframework.expression.spel.standard.SpelExpressionParser; | 16 | import org.springframework.expression.spel.standard.SpelExpressionParser; |
| 13 | import org.springframework.expression.spel.support.StandardEvaluationContext; | 17 | import org.springframework.expression.spel.support.StandardEvaluationContext; |
| @@ -86,4 +90,21 @@ public class SpringExpressionUtils { | @@ -86,4 +90,21 @@ public class SpringExpressionUtils { | ||
| 86 | return result; | 90 | return result; |
| 87 | } | 91 | } |
| 88 | 92 | ||
| 93 | + /** | ||
| 94 | + * 从 Bean 工厂,解析 EL 表达式的结果 | ||
| 95 | + * | ||
| 96 | + * @param beanFactory Bean 工程 | ||
| 97 | + * @param expressionString EL 表达式 | ||
| 98 | + * @return 执行界面 | ||
| 99 | + */ | ||
| 100 | + public static Object parseExpression(BeanFactory beanFactory, String expressionString) { | ||
| 101 | + if (StrUtil.isBlank(expressionString)) { | ||
| 102 | + return null; | ||
| 103 | + } | ||
| 104 | + Expression expression = EXPRESSION_PARSER.parseExpression(expressionString); | ||
| 105 | + StandardEvaluationContext context = new StandardEvaluationContext(); | ||
| 106 | + context.setBeanResolver(new BeanFactoryResolver(beanFactory)); | ||
| 107 | + return expression.getValue(context); | ||
| 108 | + } | ||
| 109 | + | ||
| 89 | } | 110 | } |
yudao-framework/yudao-spring-boot-starter-web/pom.xml
| @@ -32,6 +32,11 @@ | @@ -32,6 +32,11 @@ | ||
| 32 | <artifactId>spring-boot-configuration-processor</artifactId> | 32 | <artifactId>spring-boot-configuration-processor</artifactId> |
| 33 | <optional>true</optional> | 33 | <optional>true</optional> |
| 34 | </dependency> | 34 | </dependency> |
| 35 | + <dependency> | ||
| 36 | + <groupId>org.aspectj</groupId> | ||
| 37 | + <artifactId>aspectjweaver</artifactId> | ||
| 38 | + <scope>provided</scope> <!-- 解决工具类 SpringExpressionUtils 加载的时候访问不到 org.aspectj.lang.JoinPoint 问题 --> | ||
| 39 | + </dependency> | ||
| 35 | 40 | ||
| 36 | <dependency> | 41 | <dependency> |
| 37 | <groupId>com.github.xiaoymin</groupId> | 42 | <groupId>com.github.xiaoymin</groupId> |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/EmailDesensitize.java
| @@ -33,4 +33,10 @@ public @interface EmailDesensitize { | @@ -33,4 +33,10 @@ public @interface EmailDesensitize { | ||
| 33 | * 比如:example@gmail.com 脱敏之后为 e****@gmail.com | 33 | * 比如:example@gmail.com 脱敏之后为 e****@gmail.com |
| 34 | */ | 34 | */ |
| 35 | String replacer() default "$1****$2"; | 35 | String replacer() default "$1****$2"; |
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 39 | + */ | ||
| 40 | + String condition() default ""; | ||
| 41 | + | ||
| 36 | } | 42 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/annotation/RegexDesensitize.java
| @@ -35,4 +35,10 @@ public @interface RegexDesensitize { | @@ -35,4 +35,10 @@ public @interface RegexDesensitize { | ||
| 35 | * 脱敏后字符串 ******456789 | 35 | * 脱敏后字符串 ******456789 |
| 36 | */ | 36 | */ |
| 37 | String replacer() default "******"; | 37 | String replacer() default "******"; |
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 41 | + */ | ||
| 42 | + String condition() default ""; | ||
| 43 | + | ||
| 38 | } | 44 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java
| 1 | package cn.iocoder.yudao.framework.desensitize.core.regex.handler; | 1 | package cn.iocoder.yudao.framework.desensitize.core.regex.handler; |
| 2 | 2 | ||
| 3 | +import cn.hutool.extra.spring.SpringUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.spring.SpringExpressionUtils; | ||
| 3 | import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler; | 5 | import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler; |
| 4 | 6 | ||
| 5 | import java.lang.annotation.Annotation; | 7 | import java.lang.annotation.Annotation; |
| @@ -14,6 +16,10 @@ public abstract class AbstractRegexDesensitizationHandler<T extends Annotation> | @@ -14,6 +16,10 @@ public abstract class AbstractRegexDesensitizationHandler<T extends Annotation> | ||
| 14 | 16 | ||
| 15 | @Override | 17 | @Override |
| 16 | public String desensitize(String origin, T annotation) { | 18 | public String desensitize(String origin, T annotation) { |
| 19 | + Object expressionResult = SpringExpressionUtils.parseExpression(SpringUtil.getApplicationContext(), getCondition(annotation)); | ||
| 20 | + if (expressionResult instanceof Boolean && (Boolean) expressionResult) { | ||
| 21 | + return origin; | ||
| 22 | + } | ||
| 17 | String regex = getRegex(annotation); | 23 | String regex = getRegex(annotation); |
| 18 | String replacer = getReplacer(annotation); | 24 | String replacer = getReplacer(annotation); |
| 19 | return origin.replaceAll(regex, replacer); | 25 | return origin.replaceAll(regex, replacer); |
| @@ -35,4 +41,12 @@ public abstract class AbstractRegexDesensitizationHandler<T extends Annotation> | @@ -35,4 +41,12 @@ public abstract class AbstractRegexDesensitizationHandler<T extends Annotation> | ||
| 35 | */ | 41 | */ |
| 36 | abstract String getReplacer(T annotation); | 42 | abstract String getReplacer(T annotation); |
| 37 | 43 | ||
| 44 | + /** | ||
| 45 | + * el 表达式 | ||
| 46 | + * | ||
| 47 | + * @param annotation 注解信息 | ||
| 48 | + * @return el 表达式 | ||
| 49 | + */ | ||
| 50 | + abstract String getCondition(T annotation); | ||
| 51 | + | ||
| 38 | } | 52 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java
| @@ -18,4 +18,10 @@ public class DefaultRegexDesensitizationHandler extends AbstractRegexDesensitiza | @@ -18,4 +18,10 @@ public class DefaultRegexDesensitizationHandler extends AbstractRegexDesensitiza | ||
| 18 | String getReplacer(RegexDesensitize annotation) { | 18 | String getReplacer(RegexDesensitize annotation) { |
| 19 | return annotation.replacer(); | 19 | return annotation.replacer(); |
| 20 | } | 20 | } |
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + String getCondition(RegexDesensitize annotation) { | ||
| 24 | + return annotation.condition(); | ||
| 25 | + } | ||
| 26 | + | ||
| 21 | } | 27 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java
| @@ -19,4 +19,9 @@ public class EmailDesensitizationHandler extends AbstractRegexDesensitizationHan | @@ -19,4 +19,9 @@ public class EmailDesensitizationHandler extends AbstractRegexDesensitizationHan | ||
| 19 | return annotation.replacer(); | 19 | return annotation.replacer(); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | + @Override | ||
| 23 | + String getCondition(EmailDesensitize annotation) { | ||
| 24 | + return annotation.condition(); | ||
| 25 | + } | ||
| 26 | + | ||
| 22 | } | 27 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/BankCardDesensitize.java
| @@ -37,4 +37,9 @@ public @interface BankCardDesensitize { | @@ -37,4 +37,9 @@ public @interface BankCardDesensitize { | ||
| 37 | */ | 37 | */ |
| 38 | String replacer() default "*"; | 38 | String replacer() default "*"; |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 42 | + */ | ||
| 43 | + String condition() default ""; | ||
| 44 | + | ||
| 40 | } | 45 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java
| @@ -37,4 +37,9 @@ public @interface CarLicenseDesensitize { | @@ -37,4 +37,9 @@ public @interface CarLicenseDesensitize { | ||
| 37 | */ | 37 | */ |
| 38 | String replacer() default "*"; | 38 | String replacer() default "*"; |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 42 | + */ | ||
| 43 | + String condition() default ""; | ||
| 44 | + | ||
| 40 | } | 45 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java
| @@ -37,4 +37,9 @@ public @interface ChineseNameDesensitize { | @@ -37,4 +37,9 @@ public @interface ChineseNameDesensitize { | ||
| 37 | */ | 37 | */ |
| 38 | String replacer() default "*"; | 38 | String replacer() default "*"; |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 42 | + */ | ||
| 43 | + String condition() default ""; | ||
| 44 | + | ||
| 40 | } | 45 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java
| @@ -37,4 +37,9 @@ public @interface FixedPhoneDesensitize { | @@ -37,4 +37,9 @@ public @interface FixedPhoneDesensitize { | ||
| 37 | */ | 37 | */ |
| 38 | String replacer() default "*"; | 38 | String replacer() default "*"; |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 42 | + */ | ||
| 43 | + String condition() default ""; | ||
| 44 | + | ||
| 40 | } | 45 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/IdCardDesensitize.java
| @@ -37,4 +37,9 @@ public @interface IdCardDesensitize { | @@ -37,4 +37,9 @@ public @interface IdCardDesensitize { | ||
| 37 | */ | 37 | */ |
| 38 | String replacer() default "*"; | 38 | String replacer() default "*"; |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 42 | + */ | ||
| 43 | + String condition() default ""; | ||
| 44 | + | ||
| 40 | } | 45 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/MobileDesensitize.java
| @@ -37,4 +37,9 @@ public @interface MobileDesensitize { | @@ -37,4 +37,9 @@ public @interface MobileDesensitize { | ||
| 37 | */ | 37 | */ |
| 38 | String replacer() default "*"; | 38 | String replacer() default "*"; |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 42 | + */ | ||
| 43 | + String condition() default ""; | ||
| 44 | + | ||
| 40 | } | 45 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/PasswordDesensitize.java
| @@ -39,4 +39,9 @@ public @interface PasswordDesensitize { | @@ -39,4 +39,9 @@ public @interface PasswordDesensitize { | ||
| 39 | */ | 39 | */ |
| 40 | String replacer() default "*"; | 40 | String replacer() default "*"; |
| 41 | 41 | ||
| 42 | + /** | ||
| 43 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 44 | + */ | ||
| 45 | + String condition() default ""; | ||
| 46 | + | ||
| 42 | } | 47 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/annotation/SliderDesensitize.java
| @@ -40,4 +40,10 @@ public @interface SliderDesensitize { | @@ -40,4 +40,10 @@ public @interface SliderDesensitize { | ||
| 40 | * 前缀保留长度 | 40 | * 前缀保留长度 |
| 41 | */ | 41 | */ |
| 42 | int prefixKeep() default 0; | 42 | int prefixKeep() default 0; |
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * el 表达式,当执行 condition 返回 true 的时候,跳过脱敏 | ||
| 46 | + */ | ||
| 47 | + String condition() default ""; | ||
| 48 | + | ||
| 43 | } | 49 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java
| 1 | package cn.iocoder.yudao.framework.desensitize.core.slider.handler; | 1 | package cn.iocoder.yudao.framework.desensitize.core.slider.handler; |
| 2 | 2 | ||
| 3 | +import cn.hutool.extra.spring.SpringUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.spring.SpringExpressionUtils; | ||
| 3 | import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler; | 5 | import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler; |
| 4 | 6 | ||
| 5 | import java.lang.annotation.Annotation; | 7 | import java.lang.annotation.Annotation; |
| @@ -14,6 +16,10 @@ public abstract class AbstractSliderDesensitizationHandler<T extends Annotation> | @@ -14,6 +16,10 @@ public abstract class AbstractSliderDesensitizationHandler<T extends Annotation> | ||
| 14 | 16 | ||
| 15 | @Override | 17 | @Override |
| 16 | public String desensitize(String origin, T annotation) { | 18 | public String desensitize(String origin, T annotation) { |
| 19 | + Object expressionResult = SpringExpressionUtils.parseExpression(SpringUtil.getApplicationContext(), getCondition(annotation)); | ||
| 20 | + if (expressionResult instanceof Boolean && (Boolean) expressionResult) { | ||
| 21 | + return origin; | ||
| 22 | + } | ||
| 17 | int prefixKeep = getPrefixKeep(annotation); | 23 | int prefixKeep = getPrefixKeep(annotation); |
| 18 | int suffixKeep = getSuffixKeep(annotation); | 24 | int suffixKeep = getSuffixKeep(annotation); |
| 19 | String replacer = getReplacer(annotation); | 25 | String replacer = getReplacer(annotation); |
| @@ -75,4 +81,12 @@ public abstract class AbstractSliderDesensitizationHandler<T extends Annotation> | @@ -75,4 +81,12 @@ public abstract class AbstractSliderDesensitizationHandler<T extends Annotation> | ||
| 75 | */ | 81 | */ |
| 76 | abstract String getReplacer(T annotation); | 82 | abstract String getReplacer(T annotation); |
| 77 | 83 | ||
| 84 | + /** | ||
| 85 | + * el 表达式 | ||
| 86 | + * | ||
| 87 | + * @param annotation 注解信息 | ||
| 88 | + * @return el 表达式 | ||
| 89 | + */ | ||
| 90 | + abstract String getCondition(T annotation); | ||
| 91 | + | ||
| 78 | } | 92 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/BankCardDesensitization.java
| @@ -24,4 +24,9 @@ public class BankCardDesensitization extends AbstractSliderDesensitizationHandle | @@ -24,4 +24,9 @@ public class BankCardDesensitization extends AbstractSliderDesensitizationHandle | ||
| 24 | return annotation.replacer(); | 24 | return annotation.replacer(); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | + @Override | ||
| 28 | + String getCondition(BankCardDesensitize annotation) { | ||
| 29 | + return annotation.condition(); | ||
| 30 | + } | ||
| 31 | + | ||
| 27 | } | 32 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java
| @@ -22,4 +22,10 @@ public class CarLicenseDesensitization extends AbstractSliderDesensitizationHand | @@ -22,4 +22,10 @@ public class CarLicenseDesensitization extends AbstractSliderDesensitizationHand | ||
| 22 | String getReplacer(CarLicenseDesensitize annotation) { | 22 | String getReplacer(CarLicenseDesensitize annotation) { |
| 23 | return annotation.replacer(); | 23 | return annotation.replacer(); |
| 24 | } | 24 | } |
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + String getCondition(CarLicenseDesensitize annotation) { | ||
| 28 | + return annotation.condition(); | ||
| 29 | + } | ||
| 30 | + | ||
| 25 | } | 31 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java
| @@ -24,4 +24,9 @@ public class ChineseNameDesensitization extends AbstractSliderDesensitizationHan | @@ -24,4 +24,9 @@ public class ChineseNameDesensitization extends AbstractSliderDesensitizationHan | ||
| 24 | return annotation.replacer(); | 24 | return annotation.replacer(); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | + @Override | ||
| 28 | + String getCondition(ChineseNameDesensitize annotation) { | ||
| 29 | + return annotation.condition(); | ||
| 30 | + } | ||
| 31 | + | ||
| 27 | } | 32 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java
| @@ -22,4 +22,10 @@ public class DefaultDesensitizationHandler extends AbstractSliderDesensitization | @@ -22,4 +22,10 @@ public class DefaultDesensitizationHandler extends AbstractSliderDesensitization | ||
| 22 | String getReplacer(SliderDesensitize annotation) { | 22 | String getReplacer(SliderDesensitize annotation) { |
| 23 | return annotation.replacer(); | 23 | return annotation.replacer(); |
| 24 | } | 24 | } |
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + String getCondition(SliderDesensitize annotation) { | ||
| 28 | + return annotation.condition(); | ||
| 29 | + } | ||
| 30 | + | ||
| 25 | } | 31 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java
| @@ -22,4 +22,10 @@ public class FixedPhoneDesensitization extends AbstractSliderDesensitizationHand | @@ -22,4 +22,10 @@ public class FixedPhoneDesensitization extends AbstractSliderDesensitizationHand | ||
| 22 | String getReplacer(FixedPhoneDesensitize annotation) { | 22 | String getReplacer(FixedPhoneDesensitize annotation) { |
| 23 | return annotation.replacer(); | 23 | return annotation.replacer(); |
| 24 | } | 24 | } |
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + String getCondition(FixedPhoneDesensitize annotation) { | ||
| 28 | + return annotation.condition(); | ||
| 29 | + } | ||
| 30 | + | ||
| 25 | } | 31 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/IdCardDesensitization.java
| @@ -22,4 +22,10 @@ public class IdCardDesensitization extends AbstractSliderDesensitizationHandler< | @@ -22,4 +22,10 @@ public class IdCardDesensitization extends AbstractSliderDesensitizationHandler< | ||
| 22 | String getReplacer(IdCardDesensitize annotation) { | 22 | String getReplacer(IdCardDesensitize annotation) { |
| 23 | return annotation.replacer(); | 23 | return annotation.replacer(); |
| 24 | } | 24 | } |
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + String getCondition(IdCardDesensitize annotation) { | ||
| 28 | + return annotation.condition(); | ||
| 29 | + } | ||
| 30 | + | ||
| 25 | } | 31 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/MobileDesensitization.java
| @@ -23,4 +23,10 @@ public class MobileDesensitization extends AbstractSliderDesensitizationHandler< | @@ -23,4 +23,10 @@ public class MobileDesensitization extends AbstractSliderDesensitizationHandler< | ||
| 23 | String getReplacer(MobileDesensitize annotation) { | 23 | String getReplacer(MobileDesensitize annotation) { |
| 24 | return annotation.replacer(); | 24 | return annotation.replacer(); |
| 25 | } | 25 | } |
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + String getCondition(MobileDesensitize annotation) { | ||
| 29 | + return annotation.condition(); | ||
| 30 | + } | ||
| 31 | + | ||
| 26 | } | 32 | } |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/desensitize/core/slider/handler/PasswordDesensitization.java
| @@ -22,4 +22,10 @@ public class PasswordDesensitization extends AbstractSliderDesensitizationHandle | @@ -22,4 +22,10 @@ public class PasswordDesensitization extends AbstractSliderDesensitizationHandle | ||
| 22 | String getReplacer(PasswordDesensitize annotation) { | 22 | String getReplacer(PasswordDesensitize annotation) { |
| 23 | return annotation.replacer(); | 23 | return annotation.replacer(); |
| 24 | } | 24 | } |
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + String getCondition(PasswordDesensitize annotation) { | ||
| 28 | + return annotation.condition(); | ||
| 29 | + } | ||
| 30 | + | ||
| 25 | } | 31 | } |