Skip to content

Commit f065456

Browse files
committed
feat/refactor kookmin-sw#2 - application yaml 파일 수정 / 파일 구조 변경
feat - naver redirect uri 변경 refactor - security 패키지 생성
1 parent f2beff6 commit f065456

12 files changed

+44
-152
lines changed

src/main/java/org/capstone/maru/dto/CustomOAuth2User.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/main/java/org/capstone/maru/dto/KakaoOAuth2UserInfo.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/main/java/org/capstone/maru/dto/NaverOAuth2UserInfo.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/java/org/capstone/maru/dto/OAuth2UserInfo.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/main/java/org/capstone/maru/dto/OAuthAttributes.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/main/java/org/capstone/maru/dto/Role.java

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package org.capstone.maru.security;
2+
3+
import java.util.Map;
4+
import lombok.Builder;
5+
import lombok.Getter;
6+
import org.capstone.maru.domain.MemberAccount;
7+
import org.capstone.maru.security.constant.SocialType;
8+
9+
@Getter
10+
public abstract class OAuthAttributes {
11+
12+
/**
13+
* SocialType에 맞는 메소드 호출하여 OAuthAttributes 객체 반환 파라미터 : userNameAttributeName -> OAuth2 로그인 시
14+
* 키(PK)가 되는 값 / attributes : OAuth 서비스의 유저 정보들 소셜별 of 메소드(ofGoogle, ofKaKao, ofNaver)들은 각각 소셜
15+
* 로그인 API에서 제공하는 회원의 식별값(id), attributes, nameAttributeKey를 저장 후 build
16+
*/
17+
public static OAuthAttributes of(
18+
SocialType socialType,
19+
Map<String, Object> attributes
20+
) {
21+
switch (socialType) {
22+
case KAKAO -> {
23+
ofKakao(attributes);
24+
}
25+
case NAVER -> {
26+
ofNaver(attributes);
27+
}
28+
default -> throw new IllegalStateException("Unexpected value: " + socialType);
29+
}
30+
}
31+
32+
private static OAuthAttributes ofKakao(Map<String, Object> attributes) {
33+
return null;
34+
}
35+
36+
public static OAuthAttributes ofNaver(Map<String, Object> attributes) {
37+
return null;
38+
}
39+
40+
public abstract String email();
41+
42+
public abstract String nickname();
43+
}

src/main/resources/application.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spring:
4747
client-id: OvLyXvoT1NlEr8Wfiu2u
4848
client-secret: U6Or_rMFOQ
4949
authorization-grant-type: authorization_code
50-
redirect-uri: http://localhost:8080/login/auth
50+
redirect-uri: "{baseUrl}/login/oauth2/code/naver"
5151
provider:
5252
kakao:
5353
authorization-uri: https://kauth.kakao.com/oauth/authorize

0 commit comments

Comments
 (0)