Skip to content

Commit eb28077

Browse files
authored
feat: 잇슈 로그인 관련 에러 로깅 + email unique 제약 조건 제거 (#334)
* feat: NPE관련 로깅 추가 * refactor: email unique제약 조건 제거 --------- Co-authored-by: 나용준 <[email protected]>
1 parent f182641 commit eb28077

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/main/java/ssu/eatssu/domain/auth/entity/SystemAppleAuthenticator.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import java.util.Base64;
2626
import java.util.Map;
2727

28-
import static ssu.eatssu.global.handler.response.BaseResponseStatus.INVALID_IDENTITY_TOKEN;
28+
import static ssu.eatssu.global.handler.response.BaseResponseStatus.*;
2929

3030
@Component
3131
@RequiredArgsConstructor
@@ -49,10 +49,19 @@ private OAuthInfo getOAuthInfoByPublicKey(String identityToken, PublicKey public
4949
.parseClaimsJws(identityToken)
5050
.getBody();
5151

52-
//Claims 에서 email, providerId(사용자 식별값) 를 추출한다.
52+
Object emailObj = claims.get("email");
53+
Object providerIdObj = claims.get("sub");
54+
55+
if (providerIdObj == null) {
56+
throw new BaseException(NOT_FOUND_PROVIDER_ID);
57+
}
58+
if (emailObj == null) {
59+
throw new BaseException(NOT_FOUND_EMAIL);
60+
}
61+
5362
try {
54-
String email = claims.get("email").toString();
55-
String providerId = claims.get("sub").toString();
63+
String email = emailObj.toString();
64+
String providerId = providerIdObj.toString();
5665
return new OAuthInfo(email, providerId);
5766
} catch (ExpiredJwtException exception) {
5867
throw new BaseException(INVALID_IDENTITY_TOKEN);

src/main/java/ssu/eatssu/domain/user/entity/User.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public class User extends BaseTimeEntity {
4949
private Long id;
5050
@Enumerated(EnumType.STRING)
5151
private Role role;
52-
@Column(unique = true)
5352
private String email;
5453
private String nickname;
5554
@Enumerated(EnumType.STRING)

src/main/java/ssu/eatssu/global/handler/response/BaseResponseStatus.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public enum BaseResponseStatus {
7575
NOT_FOUND_PARTNERSHIP(false, HttpStatus.NOT_FOUND, 40410, "해당 제휴를 찾을 수 없습니다."),
7676
NOT_FOUND_PARTNERSHIP_RESTAURANT(false, HttpStatus.NOT_FOUND, 40411, "해당 제휴 식당을 찾을 수 없습니다."),
7777
INVALID_NICKNAME(false, HttpStatus.NOT_FOUND, 40412, "잘못된 닉네임입니다."),
78+
NOT_FOUND_PROVIDER_ID(false, HttpStatus.NOT_FOUND, 40413, "Claims에서 ProviderId(sub)를 찾을 수 없습니다."),
79+
NOT_FOUND_EMAIL(false, HttpStatus.NOT_FOUND, 40414, "Claims에서 이메일을 찾을 수 없습니다."),
7880

7981
/**
8082
* 405 METHOD_NOT_ALLOWED 지원하지 않은 method 호출

0 commit comments

Comments
 (0)