使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密

时间:2023-03-09 16:30:30
使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密
一、引入security启动器
使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密
在子工程中直接引入,不用指定版本号
二、在启动类中把BCryptPasswordEncoder对象注入到容器中
使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密
三、在service 层注入
使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密
四、 调用encode方法加密
使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密
在注册页面提交,查看数据库密码不在是明文
使用 spring security 中的BcryptPasswordEncoder对象对用户密码进行加密