-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 카카오 프로필 응답 받기 * feat: 카카오 로그인 후 세션 발급
- Loading branch information
Showing
10 changed files
with
154 additions
and
36 deletions.
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
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
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
12 changes: 12 additions & 0 deletions
12
server/src/main/java/sunflower/server/auth/client/response/KakaoUserProfileResponse.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 sunflower.server.auth.client.response; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class KakaoUserProfileResponse { | ||
|
||
private final String nickname; | ||
private final Long oauthId; | ||
} |
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,9 @@ | ||
package sunflower.server.entity; | ||
|
||
public enum LoginType { | ||
|
||
BASIC, | ||
KAKAO, | ||
GOOGLE, | ||
; | ||
} |
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
15 changes: 13 additions & 2 deletions
15
server/src/main/java/sunflower/server/repository/MemberRepository.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,20 +1,31 @@ | ||
package sunflower.server.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import sunflower.server.entity.LoginType; | ||
import sunflower.server.entity.Member; | ||
|
||
import java.util.NoSuchElementException; | ||
import java.util.Optional; | ||
|
||
public interface MemberRepository extends JpaRepository<Member, Long> { | ||
|
||
default Member getByLoginId(String loginId) { | ||
default Member getByLoginId(final String loginId) { | ||
final Optional<Member> member = findByLoginId(loginId); | ||
if (member.isEmpty()) { | ||
throw new NoSuchElementException("Member with login id " + loginId + " not found"); | ||
} | ||
return member.get(); | ||
} | ||
|
||
Optional<Member> findByLoginId(String loginId); | ||
Optional<Member> findByLoginId(final String loginId); | ||
|
||
default Member getByLoginTypeAndOauthId(final LoginType loginType, final Long oauthId) { | ||
final Optional<Member> member = findByLoginTypeAndOauthId(loginType, oauthId); | ||
if (member.isEmpty()) { | ||
throw new NoSuchElementException("Member with login type, oauthId " + loginType.name() + oauthId + " not found"); | ||
} | ||
return member.get(); | ||
} | ||
|
||
Optional<Member> findByLoginTypeAndOauthId(final LoginType loginType, final Long oauthId); | ||
} |