Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HIMIN-232] refactor: 회원 비밀번호 검증 후 비번 암호화 #117

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

Yiseull
Copy link
Member

@Yiseull Yiseull commented Sep 18, 2023

PR 확인 항목

PR 보내기전에 아래 항목들을 만족 하였는지 체크 해주세요

  • 곤모슬 팀에서 정한 커밋 메시지 규칙과 일치하는가?
  • 곤모슬 팀에서 정한 코딩 컨벤션과 일치하는가?

PR 종류

어떤 종류의 PR인지 아래 항목중에 체크 해주세요

  • 버그 수정
  • 기능 추가
  • 코드 스타일 변경 (formatting, local variables)
  • 리팩토링 (기능 변경 X)
  • 빌드 관련 수정
  • 문서 내용 수정
  • 테스트 추가
  • 그 외, 어떤 종류인지 기입 바람:

어떤 기능이 추가 되었나요?

이전에는 서비스단에서 비밀번호를 암호화한 값을 Member에 넘겨주었습니다. 하지만 이 방식에 문제가 있다는 것을 발견했습니다. 바로 비밀번호 길이에 대한 검증을 제외한 나머지 검증을 하지 못한다는 것이었습니다.

실제로 bcrypt 생성 사이트에서 실험해본 결과, 아무것도 입력하지 않을 때와 공백이 입력될 때 모두 bcrypt로 암호화되었습니다. 이 말은 공백에 대해서는 검증을 하지 못한다는 말입니다.

그래서 Member.passwor(...) 라는 정적 메서드를 만들었습니다. 이 메서드에서 비밀번호를 검증하고 통과한다면 암호화된 비밀번호를 반환하도록 하여, 회원 생성과 업데이트 시 해당 메서드를 사용하도록 변경하였습니다.

Issue Number: HIMIN-232

기존에 있던 기능에 영향을 주나요?

  • 아니요

기타

@Yiseull Yiseull self-assigned this Sep 18, 2023
Comment on lines +100 to +104
public static String password(String password, String encodedPassword) {
validatePassword(password);
return encodedPassword;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator

@BeommoKoo-dev BeommoKoo-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

승인합니다 👍

Copy link
Collaborator

@Curry4182 Curry4182 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!!

@Yiseull Yiseull merged commit 4afaa5b into main Sep 18, 2023
1 check passed
@BeommoKoo-dev BeommoKoo-dev deleted the HIMIN-232--yiseul-encode-password-when-update branch September 20, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants