mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 10:57:10 +08:00 
			
		
		
		
	build: continew-starter 2.11.0 => 2.12.0
1.使用 PasswordEncoderConstants 常量 2.兼容redis没配置密码时出现redisson实例化失败的问题 3.修复导出时无法正确捕捉异常的问题 4.修复默认 Response 类 msg 传递污染的问题 5.修复 /file/ 注册资源映射时被解析为 /file//** 的问题
This commit is contained in:
		@@ -18,8 +18,7 @@ package top.continew.admin.common.config.mybatis;
 | 
			
		||||
 | 
			
		||||
import org.springframework.security.crypto.password.PasswordEncoder;
 | 
			
		||||
import top.continew.starter.security.crypto.encryptor.IEncryptor;
 | 
			
		||||
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
import top.continew.starter.security.password.constant.PasswordEncoderConstants;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * BCrypt 加/解密处理器(不可逆)
 | 
			
		||||
@@ -29,10 +28,6 @@ import java.util.regex.Pattern;
 | 
			
		||||
 */
 | 
			
		||||
public class BCryptEncryptor implements IEncryptor {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * BCrypt 正则表达式
 | 
			
		||||
     */
 | 
			
		||||
    private static final Pattern BCRYPT_PATTERN = Pattern.compile("\\A\\$2(a|y|b)?\\$(\\d\\d)\\$[./0-9A-Za-z]{53}");
 | 
			
		||||
    private final PasswordEncoder passwordEncoder;
 | 
			
		||||
 | 
			
		||||
    public BCryptEncryptor(PasswordEncoder passwordEncoder) {
 | 
			
		||||
@@ -42,7 +37,7 @@ public class BCryptEncryptor implements IEncryptor {
 | 
			
		||||
    @Override
 | 
			
		||||
    public String encrypt(String plaintext, String password, String publicKey) {
 | 
			
		||||
        // 如果已经是 BCrypt 加密格式,直接返回
 | 
			
		||||
        if (BCRYPT_PATTERN.matcher(plaintext).matches()) {
 | 
			
		||||
        if (PasswordEncoderConstants.BCRYPT_PATTERN.matcher(plaintext).matches()) {
 | 
			
		||||
            return plaintext;
 | 
			
		||||
        }
 | 
			
		||||
        return passwordEncoder.encode(plaintext);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user