- 기존 TokenVerifier에 토큰 검증과 회원 인증책임을 분리 - ConfirmRegisterAccountProcessor를 추가 - verify 메서드가 void를 반환하도록 변경 - 테스트에서 MailTokenVerifierStub 제거
24 lines
537 B
Java
24 lines
537 B
Java
package com.yam.app.account.domain;
|
|
|
|
public final class TokenVerifier {
|
|
|
|
private final AccountReader accountReader;
|
|
|
|
public TokenVerifier(AccountReader accountReader) {
|
|
this.accountReader = accountReader;
|
|
}
|
|
|
|
public void verify(String token, String email) {
|
|
var account = accountReader.findByEmail(email);
|
|
|
|
if (account == null) {
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
if (!account.isValidToken(token)) {
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
}
|
|
}
|