-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 로그인 입력 받아오는 DTO 생성 * feat(PasswordEncoder): 주석 추가 및 비밀 번호 검증 로직 구현 * feat(MemberService): 로그인 정보로 멤버 조회 및 비밀번호 검증 로직 구현 * feat(MemberService): 비밀번호 불일치 예외 처리 * feat(AuthService): 입력 받은 로그인 정보로 JWT 토큰 방식 로그인 구현 * feat(AuthController): 로그인 정보 입력 받는 컨트롤러 구현 * feat(Auth): refreshToken 재발급 서비스 및 컨트롤러 구현 * feat(AuthService): @transactional 적용
- Loading branch information
Showing
7 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package econo.buddybridge.auth.dto; | ||
|
||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record LoginReqDto( | ||
@NotBlank(message = "이메일을 입력해주세요.") | ||
@Email(message = "이메일 형식이 올바르지 않습니다.") | ||
String email, | ||
|
||
@NotBlank(message = "비밀번호를 입력해주세요.") | ||
String password | ||
) { | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/econo/buddybridge/auth/service/AuthService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
package econo.buddybridge.auth.service; | ||
|
||
import econo.buddybridge.auth.dto.LoginReqDto; | ||
import econo.buddybridge.auth.jwt.AuthToken; | ||
import econo.buddybridge.auth.jwt.service.AuthTokenService; | ||
import econo.buddybridge.member.dto.MemberResDto; | ||
import econo.buddybridge.member.dto.MemberSignUpReqDto; | ||
import econo.buddybridge.member.dto.MemberSignUpResDto; | ||
import econo.buddybridge.member.service.MemberService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AuthService { | ||
|
||
private final MemberService memberService; | ||
private final AuthTokenService authTokenService; | ||
|
||
@Transactional | ||
public MemberSignUpResDto signUp(MemberSignUpReqDto memberSignUpReqDto) { | ||
return memberService.createSignUpMember(memberSignUpReqDto); | ||
} | ||
|
||
@Transactional | ||
public AuthToken loginWithToken(LoginReqDto params) { | ||
MemberResDto member = memberService.findMemberByEmailAndPassword(params); | ||
return authTokenService.generateAuthToken(member.memberId()); | ||
} | ||
|
||
@Transactional | ||
public AuthToken reissue(String refreshToken) { | ||
return authTokenService.reissue(refreshToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/econo/buddybridge/member/exception/InvalidPasswordException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package econo.buddybridge.member.exception; | ||
|
||
import econo.buddybridge.common.exception.BusinessException; | ||
|
||
public class InvalidPasswordException extends BusinessException { | ||
|
||
public static BusinessException EXCEPTION = new InvalidPasswordException(); | ||
|
||
private InvalidPasswordException() { | ||
super(MemberErrorCode.INVALID_PASSWORD); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters