28 lines
808 B
Java
28 lines
808 B
Java
package com.labelsys.backend.config;
|
||
|
||
import org.springframework.context.annotation.Bean;
|
||
import org.springframework.context.annotation.Configuration;
|
||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||
|
||
/**
|
||
* 安全配置类
|
||
*
|
||
* 配置安全相关的 Bean,如密码编码器等。
|
||
*/
|
||
@Configuration
|
||
public class SecurityBeanConfig {
|
||
|
||
/**
|
||
* 创建密码编码器
|
||
*
|
||
* <p>使用 BCrypt 算法对密码进行加密,BCrypt 是一种安全的密码哈希算法,
|
||
* 具有自动加盐和可配置的计算复杂度特性。
|
||
*
|
||
* @return BCryptPasswordEncoder 实例
|
||
*/
|
||
@Bean
|
||
public PasswordEncoder passwordEncoder() {
|
||
return new BCryptPasswordEncoder();
|
||
}
|
||
} |