Commit 09afdaafcf5e68e355abec0f29ae60b099cce5a0
1 parent
b9ba17a4
!24 【轻量级 PR】:PasswordEncoder 加密复杂度自定义
Showing
2 changed files
with
5 additions
and
1 deletions
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java
| @@ -37,4 +37,8 @@ public class SecurityProperties { | @@ -37,4 +37,8 @@ public class SecurityProperties { | ||
| 37 | */ | 37 | */ |
| 38 | private List<String> permitAllUrls = Collections.emptyList(); | 38 | private List<String> permitAllUrls = Collections.emptyList(); |
| 39 | 39 | ||
| 40 | + /** | ||
| 41 | + * PasswordEncoder 加密复杂度,越高开销越大 | ||
| 42 | + */ | ||
| 43 | + private Integer passwordEncoderLength = 4; | ||
| 40 | } | 44 | } |
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 { | @@ -69,7 +69,7 @@ public class YudaoSecurityAutoConfiguration { | ||
| 69 | */ | 69 | */ |
| 70 | @Bean | 70 | @Bean |
| 71 | public PasswordEncoder passwordEncoder() { | 71 | public PasswordEncoder passwordEncoder() { |
| 72 | - return new BCryptPasswordEncoder(); | 72 | + return new BCryptPasswordEncoder(securityProperties.getPasswordEncoderLength()); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | /** | 75 | /** |