From c2d70ce831ac4864c0d30c7c9f069a4504895c05 Mon Sep 17 00:00:00 2001 From: Fanjc <271366833@qq.com> Date: Thu, 23 Feb 2023 05:24:54 +0000 Subject: [PATCH] =?UTF-8?q?PasswordEncoder=20=E5=8A=A0=E5=AF=86=E5=A4=8D?= =?UTF-8?q?=E6=9D=82=E5=BA=A6=E8=87=AA=E5=AE=9A=E4=B9=89=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E5=9C=A8nacos=E4=B8=AD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fanjc <271366833@qq.com> --- .../yudao/framework/security/config/SecurityProperties.java | 6 ++++++ .../security/config/YudaoSecurityAutoConfiguration.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java index 7454b5ff6..b2045bb5a 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java @@ -32,6 +32,12 @@ public class SecurityProperties { @NotEmpty(message = "mock 模式的密钥不能为空") // 这里设置了一个默认值,因为实际上只有 mockEnable 为 true 时才需要配置。 private String mockSecret = "test"; + + /** + * PasswordEncoder 加密复杂度,越高开销越大 + */ + private Integer passwordEncoderLength =4; + /** * 免登录的 URL 列表 */ diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java index 7a766eb83..47c363446 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java @@ -69,7 +69,7 @@ public class YudaoSecurityAutoConfiguration { */ @Bean public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); + return new BCryptPasswordEncoder(securityProperties.getPasswordEncoderLength()); } /**