-
Notifications
You must be signed in to change notification settings - Fork 0
Issue:(#9, #10) cors 설정 변경 및 온보딩 구현 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cc2ff9c
d8a6279
ddeebdb
f5e5e9c
a92046b
d9a5829
6b6e1d8
d4084fe
fe00c1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ class CustomCorsConfiguration { | |
@Bean | ||
fun corsConfigurationSource(): CorsConfigurationSource { | ||
val configuration = CorsConfiguration() | ||
configuration.allowedOrigins = listOf("http://localhost:5173", "http://localhost:8080") | ||
configuration.allowedOrigins = | ||
listOf("http://localhost:5173", "http://localhost:8080", "https://frontend-sarang.vercel.app") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 프론트에서 로컬로 개발할 때 5173포트쓰나? 보통 3000번 포트 쓰지 않아? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
프론트 포트 5173이래 |
||
configuration.allowedMethods = listOf("GET", "POST", "PUT", "DELETE", "OPTIONS") | ||
configuration.allowedHeaders = listOf("*") | ||
configuration.allowCredentials = true | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package gomushin.backend.core.jwt | ||
|
||
interface JwtTokenProvider { | ||
fun provideAccessToken(userId: Long): String | ||
fun provideAccessToken(userId: Long, role: String): String | ||
fun getMemberIdFromToken(token: String): Long | ||
fun validateToken(token: String): Boolean | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,13 @@ class CustomSuccessHandler( | |
|
||
var accessToken = "" | ||
getMemberByEmail(principal.getEmail())?.let { | ||
accessToken = jwtTokenProvider.provideAccessToken(it.id) | ||
accessToken = jwtTokenProvider.provideAccessToken(it.id, it.role.name) | ||
} ?: run { | ||
accessToken = jwtTokenProvider.provideAccessToken(principal.getUserId()) | ||
accessToken = jwtTokenProvider.provideAccessToken(principal.getUserId(), principal.getRole()) | ||
} | ||
|
||
response!!.addCookie(createCookie("access_token", accessToken)) | ||
response.sendRedirect("http://localhost:8080") // TODO: 프론트엔드 주소로 변경 , 환경변수 처리 | ||
response.sendRedirect("https://frontend-sarang.vercel.app") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 처음에 프론트는 로컬환경에서 개발할건데 이렇게 하면 프론트입자에서 로컬에 테스트 할때 토큰을 못 받지 않나? 바로 배포주소로 리디렉션되니깐? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
아 맞네 이것도 프론트 주소로 바꿀게 |
||
} | ||
|
||
private fun createCookie(key: String, value: String): Cookie { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gomushin.backend.member.application | ||
|
||
import gomushin.backend.core.CustomUserDetails | ||
import gomushin.backend.member.domain.service.MemberInfoService | ||
import gomushin.backend.member.presentation.dto.response.GuestInfoResponse | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class MemberInfoFacade( | ||
private val memberInfoService: MemberInfoService, | ||
) { | ||
fun getMemberInfo(customUserDetails: CustomUserDetails): Any { | ||
val authorities = customUserDetails.authorities | ||
|
||
// if (authorities.any { it.authority == "ROLE_GUEST" }) { | ||
val member = memberInfoService.getGuestInfo(customUserDetails.getId()) | ||
return GuestInfoResponse.of(member) | ||
// } | ||
|
||
HoyeongJeon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// TODO: Member 구현 시 , 분기를 통해 MEMBER와 GUEST를 구분할 수 있도록 수정 | ||
} | ||
HoyeongJeon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package gomushin.backend.member.application | ||
|
||
import gomushin.backend.member.domain.service.OnboardingService | ||
import gomushin.backend.member.presentation.dto.request.OnboardingRequest | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class OnboardingFacade( | ||
private val onboardingService: OnboardingService, | ||
) { | ||
|
||
fun onboarding(id: Long, onboardingRequest: OnboardingRequest) = onboardingService.onboarding(id, onboardingRequest) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
버전을 내린 이유가 궁금해!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 이건 Swagger 응답이 좀 이상하게 나와서 버전 문제인 줄 알고 내렸거든.
근데 버전 문제는 아니었어
이건 내가 내렸다 안 올렸네
스웨거 2.8.1 이나 2.7.0 은 사용하는데 별 차이는 없으니까 그냥 가도 될 것 같아