Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public Long findOrCreateMember(OauthProfile profile, LoginPlatform loginPlatform
@Override
@Transactional(readOnly = true)
public Member getCurrentMember(Long memberId) {
return memberRepository.findById(memberId)
return memberRepository.findByIdWithPartner(memberId)
.orElseThrow(() -> new ServiceException(ErrorCode.MEMBER_NOT_FOUND));
}

Expand Down Expand Up @@ -515,14 +515,17 @@ public LoginResponse kakaoLogin(String accessToken, HttpServletRequest request,
/**
* 중복된 JWT 발급 및 LoginResponse 생성을 처리하는 공통 메서드
*/
@Transactional(readOnly = true)
private LoginResponse createLoginResponse(Long memberId,
HttpServletRequest request,
HttpServletResponse response) {
Member me = memberRepository.findById(memberId)
Member me = memberRepository.findByIdWithPartner(memberId)
.orElseThrow(() -> new ServiceException(MEMBER_NOT_FOUND));

Member partner = me.getPartner();
Long partnerId = (partner != null) ? partner.getId() : null;
String partnerName = (partner != null) ? partner.getName() : null;
String partnerNickname = (partner != null) ? partner.getNickname() : null;

// 토큰
TokenPair tokenPair = tokenService.createTokenPair(
Expand All @@ -535,12 +538,9 @@ private LoginResponse createLoginResponse(Long memberId,
tokenService.sendTokensToClient(request, response, tokenPair);
tokenService.storeRefreshTokenInRedis(memberId, tokenPair.getRefreshToken());

//
// 나의 정보
String name = me.getName();
String myNickname = me.getNickname(); // 파트너가 '나'에게 준 애칭
String partnerName = (partner != null) ? partner.getName() : null;
String partnerNickname = (partner != null) ? partner.getNickname() : null;

String myNickname = me.getNickname();
LocalDate relationshipStartDate = me.getRelationshipStartDate();

return LoginResponse.of(
Expand All @@ -555,7 +555,6 @@ private LoginResponse createLoginResponse(Long memberId,
);
}


public LoginResponse privateCreateLoginResponse(Long memberId,
HttpServletRequest request,
HttpServletResponse response) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.yeoro.twogether.global.config;

import com.yeoro.twogether.global.filter.JwtAuthenticationFilter;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -19,16 +18,15 @@
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import java.util.Arrays;

@Configuration
@EnableWebSecurity
public class SecurityConfig {

@Value("${custom.site.frontUrl}")
private String frontUrl;

@Value("${custom.site.vercelUrl}")
private String vercelUrl;

private final JwtAuthenticationFilter jwtAuthenticationFilter;

public SecurityConfig(JwtAuthenticationFilter jwtAuthenticationFilter) {
Expand Down Expand Up @@ -79,7 +77,6 @@ public UrlBasedCorsConfigurationSource corsConfigurationSource() {
configuration.setAllowedOrigins(
Arrays.asList(
frontUrl,
vercelUrl,
"http://localhost:3000",
"https://localhost:3000",
"https://localhost",
Expand Down