Skip to content

Commit c552c60

Browse files
committed
/member/me return 404 when miss auth
1 parent ca93f48 commit c552c60

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/main/java/org/fontory/fontorybe/member/controller/ProfileController.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.fontory.fontorybe.authentication.adapter.inbound.annotation.Login;
1111
import org.fontory.fontorybe.authentication.application.AuthService;
1212
import org.fontory.fontorybe.authentication.domain.UserPrincipal;
13-
import org.fontory.fontorybe.authentication.domain.exception.AuthenticationRequiredException;
1413
import org.fontory.fontorybe.file.application.port.CloudStorageService;
1514
import org.fontory.fontorybe.file.application.port.FileService;
1615
import org.fontory.fontorybe.file.domain.FileUploadResult;
@@ -21,6 +20,7 @@
2120
import org.fontory.fontorybe.member.controller.port.MemberLookupService;
2221
import org.fontory.fontorybe.member.controller.port.MemberUpdateService;
2322
import org.fontory.fontorybe.member.domain.Member;
23+
import org.fontory.fontorybe.member.domain.exception.MemberNotFoundException;
2424
import org.fontory.fontorybe.member.infrastructure.entity.MemberStatus;
2525
import org.springframework.http.HttpStatus;
2626
import org.springframework.http.ResponseEntity;
@@ -51,13 +51,18 @@ public class ProfileController {
5151
)
5252
@GetMapping
5353
public ResponseEntity<MyProfileResponse> getMyProfile(
54-
@Login UserPrincipal me) {
54+
@Login(required = false) UserPrincipal me) {
55+
if (me == null) {
56+
log.info("Request received: getMyInfo - no login");
57+
throw new MemberNotFoundException();
58+
}
5559
Long requestMemberId = me.getId();
5660
log.info("Request received: getMyInfo member ID: {}", requestMemberId);
5761

5862
Member lookupMember = memberLookupService.getOrThrowById(requestMemberId);
5963
if (lookupMember.getStatus().equals(MemberStatus.ONBOARDING)) {
60-
throw new AuthenticationRequiredException();
64+
log.info("Request received: getMyInfo - member is onboarding");
65+
throw new MemberNotFoundException();
6166
}
6267
String fileUrl = cloudStorageService.getProfileImageUrl(lookupMember.getProfileImageKey());
6368
log.info("ProfileImageUrl generated : {}", fileUrl);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
spring.jpa.hibernate.ddl-auto=create
1+
spring.jpa.hibernate.ddl-auto=update
22

33
cookies.domain=.fontory.co.kr

0 commit comments

Comments
 (0)