-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 适配 ContiNew Starter 加密模块(安全模块)
- Loading branch information
Showing
10 changed files
with
89 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...mon/src/main/java/top/charles7c/continew/admin/common/config/mybatis/BCryptEncryptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package top.charles7c.continew.admin.common.config.mybatis; | ||
|
||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import top.charles7c.continew.starter.security.crypto.encryptor.IEncryptor; | ||
|
||
/** | ||
* BCrypt 加/解密处理器(不可逆) | ||
* | ||
* @author Charles7c | ||
* @since 2024/2/8 22:29 | ||
*/ | ||
public class BCryptEncryptor implements IEncryptor { | ||
|
||
private final PasswordEncoder passwordEncoder; | ||
|
||
public BCryptEncryptor(PasswordEncoder passwordEncoder) { | ||
this.passwordEncoder = passwordEncoder; | ||
} | ||
|
||
@Override | ||
public String encrypt(String plaintext, String password, String publicKey) throws Exception { | ||
return passwordEncoder.encode(plaintext); | ||
} | ||
|
||
@Override | ||
public String decrypt(String ciphertext, String password, String privateKey) throws Exception { | ||
return ciphertext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters