Skip to content

Commit

Permalink
feat/refactor kookmin-sw#2 - application yaml 파일 수정 / 파일 구조 변경
Browse files Browse the repository at this point in the history
feat
- naver redirect uri 변경

refactor
- security 패키지 생성
  • Loading branch information
leejh7 committed Mar 10, 2024
1 parent f2beff6 commit f065456
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 152 deletions.
14 changes: 0 additions & 14 deletions src/main/java/org/capstone/maru/dto/CustomOAuth2User.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/org/capstone/maru/dto/KakaoOAuth2UserInfo.java

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/java/org/capstone/maru/dto/NaverOAuth2UserInfo.java

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/org/capstone/maru/dto/OAuth2UserInfo.java

This file was deleted.

65 changes: 0 additions & 65 deletions src/main/java/org/capstone/maru/dto/OAuthAttributes.java

This file was deleted.

14 changes: 0 additions & 14 deletions src/main/java/org/capstone/maru/dto/Role.java

This file was deleted.

43 changes: 43 additions & 0 deletions src/main/java/org/capstone/maru/security/OAuth2Response.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.capstone.maru.security;

import java.util.Map;
import lombok.Builder;
import lombok.Getter;
import org.capstone.maru.domain.MemberAccount;
import org.capstone.maru.security.constant.SocialType;

@Getter
public abstract class OAuthAttributes {

/**
* SocialType에 맞는 메소드 호출하여 OAuthAttributes 객체 반환 파라미터 : userNameAttributeName -> OAuth2 로그인 시
* 키(PK)가 되는 값 / attributes : OAuth 서비스의 유저 정보들 소셜별 of 메소드(ofGoogle, ofKaKao, ofNaver)들은 각각 소셜
* 로그인 API에서 제공하는 회원의 식별값(id), attributes, nameAttributeKey를 저장 후 build
*/
public static OAuthAttributes of(
SocialType socialType,
Map<String, Object> attributes
) {
switch (socialType) {
case KAKAO -> {
ofKakao(attributes);
}
case NAVER -> {
ofNaver(attributes);
}
default -> throw new IllegalStateException("Unexpected value: " + socialType);
}
}

private static OAuthAttributes ofKakao(Map<String, Object> attributes) {
return null;
}

public static OAuthAttributes ofNaver(Map<String, Object> attributes) {
return null;
}

public abstract String email();

public abstract String nickname();
}
2 changes: 1 addition & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spring:
client-id: OvLyXvoT1NlEr8Wfiu2u
client-secret: U6Or_rMFOQ
authorization-grant-type: authorization_code
redirect-uri: http://localhost:8080/login/auth
redirect-uri: "{baseUrl}/login/oauth2/code/naver"
provider:
kakao:
authorization-uri: https://kauth.kakao.com/oauth/authorize
Expand Down

0 comments on commit f065456

Please sign in to comment.