Spring Security支持MD5
时间: 2024-02-22 10:23:53 浏览: 78
是的,Spring Security支持MD5密码加密。你可以通过自定义PasswordEncoder来告诉Spring Security使用MD5来处理密码。在SecurityConfig类中,你可以注册一个bean来实现自定义的PasswordEncoder,如下所示:
```java
//告诉SpringSecurity我要用我自定义的Encoder来处理密码
@Bean
public PasswordEncoder passwordEncoder() {
return new MD5PasswordEncoder();
}
```
然后在认证配置中,你可以使用`auth.userDetailsService(customUserService())`从数据库中进行账号密码验证。通过这种方式,Spring Security将使用自定义的PasswordEncoder来加密和验证密码。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [RuoYi SpringSecurity使用MD5加密用户密码](https://blog.csdn.net/u012373523/article/details/129589643)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [SpringSecurity使用MD5+盐值加密](https://blog.csdn.net/laionly/article/details/106074346)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [SpringSecurity+JWT+自定义MD5加盐值校验](https://blog.csdn.net/qq_42264638/article/details/124588873)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文