PasswordEncoder 加密复杂度自定义,可在nacos中配置

Signed-off-by: Fanjc <271366833@qq.com>
This commit is contained in:
Fanjc 2023-02-23 05:24:54 +00:00 committed by Gitee
parent 220d727605
commit c2d70ce831
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,12 @@ public class SecurityProperties {
@NotEmpty(message = "mock 模式的密钥不能为空") // 这里设置了一个默认值因为实际上只有 mockEnable true 时才需要配置
private String mockSecret = "test";
/**
* PasswordEncoder 加密复杂度越高开销越大
*/
private Integer passwordEncoderLength =4;
/**
* 免登录的 URL 列表
*/

View File

@ -69,7 +69,7 @@ public class YudaoSecurityAutoConfiguration {
*/
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
return new BCryptPasswordEncoder(securityProperties.getPasswordEncoderLength());
}
/**