( ์ ๊ฐ ์์ ํ๋ ํ๋ก์ ํธ ์ฝ๋ ๊ธฐ๋ฐ์ผ๋ก ์ค๋ช ํ๊ณ ์์ต๋๋ค.)
์คํ๋ง ์ํ๋ฆฌํฐ ๋น๋ฐ๋ฒํธ ์ํธํ์ ๊ดํ ์ด๋ก ์ ์ด์ชฝ ๊ฒ์๋ฌผ ์ฐธ๊ณ !
https://hyejux.tistory.com/801
[Spring Security] BCrypt ํด์ ํจ์ ์๊ณ ๋ฆฌ์ฆ
Spring Security ์์๋ BCryptPasswordEncoder ๋ผ๋ ํด๋์ค๋ฅผ ์ ๊ณตํ๋๋ฐ์ด ํด๋์ค๋ ๋น๋ฐ๋ฒํธ๋ฅผ ์ํธํํ ๋ ์ฌ์ฉํ๋ค. ์ด๋ ์ํธํ ๋ฐฉ์์ BCrypt ํด์ ํจ์ ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ๋๋ฐBCrypt ํด์ ํจ์ ์๊ณ
hyejux.tistory.com
https://hyejux.tistory.com/802
[Spring Security] BCryptPasswordEncoder ํด๋์ค
[ ์คํ๋ง ์ํ๋ฆฌํฐ ๋น๋ฐ๋ฒํธ ์ํธํ ] BCryptPasswordEncoder ๋ ์คํ๋ง ์ํ๋ฆฌํฐ(ํ๋ ์์ํฌ) ์์ ์ ๊ณตํ๋ ํด๋์ค ๋จ๋ฐฉํฅ ํด์ ํจ์์ธ BCrypt ๋ฅผ ์ฌ์ฉํ๋ค.BCrypt ์ ๊ฒฝ์ฐ์๋ ์ํธ(salt) ๋ฅผ ๋ถ์ฌํ์ฌ
hyejux.tistory.com
๋น๋ฐ๋ฒํธ ์ํธํ ๊ตฌํ
`BCryptPasswordEncoder` ํด๋์ค์ 'encode' ๋ฉ์๋ ์ฌ์ฉํ๋ฉด ๊ฐํธํ๊ฒ ๋น๋ฐ๋ฒํธ๋ฅผ ์ํธํ ํ ์ ์๋ค.
@Autowired
BCryptPasswordEncoder bCryptPasswordEncoder;
.
.
.
@Override
public void employeeUpdateMypagePw(EmployeeDTO dto) {
if (dto.getEmployeePw() != null) {
dto.setEmployeePw(bCryptPasswordEncoder.encode(dto.getEmployeePw()));
}
employeeMapper.employeeUpdateMypagePw(dto);
}
์ง์ ๋ฑ๋ก
DB ์์ ํ์ธ
์ํธํ ๋ ๊ฐ์ด ๋ค์ด๊ฐ ๊ฑธ ํ์ธ ํ ์ ์๋ค.