Skip to content

Commit e5d7a26

Browse files
authored
Merge pull request #120 from wafflestudio/feat/socialLogin
Feat/social login
2 parents 339ef39 + 48256ef commit e5d7a26

4 files changed

Lines changed: 27 additions & 6 deletions

File tree

.idea/sqldialects.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hangsha/src/main/kotlin/com/team1/hangsha/config/SecurityConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class SecurityConfig(
3030
@Bean
3131
fun filterChain(http: HttpSecurity): SecurityFilterChain {
3232
http
33+
.cors { }
3334
.csrf { it.disable() }
3435
.formLogin { it.disable() }
3536
.httpBasic { it.disable() }

hangsha/src/main/kotlin/com/team1/hangsha/config/WebConfig.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.team1.hangsha.config
33
import com.team1.hangsha.user.UserArgumentResolver
44
import org.springframework.context.annotation.Configuration
55
import org.springframework.web.method.support.HandlerMethodArgumentResolver
6+
import org.springframework.web.servlet.config.annotation.CorsRegistry
67
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
78
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
89

@@ -19,4 +20,16 @@ class WebConfig(
1920
registry.addResourceHandler("/static/**")
2021
.addResourceLocations("classpath:/static/")
2122
}
23+
24+
override fun addCorsMappings(registry: CorsRegistry) {
25+
registry.addMapping("/**") // 모든 경로에 대해
26+
.allowedOrigins(
27+
"http://localhost:3000", // 로컬 프론트엔드
28+
"https://hangsha-dev.wafflestudio.com", // Dev 프론트엔드
29+
"https://hangsha.wafflestudio.com" // Prod 프론트엔드
30+
)
31+
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
32+
.allowedHeaders("*")
33+
.allowCredentials(true) // 🌟 쿠키 주고받기 허용 (매우 중요)
34+
}
2235
}

hangsha/src/main/resources/application.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ jwt:
6969
access-expiration-ms: 3600000
7070
refresh-expiration-ms: 1209600000
7171

72-
auth: # default cookie setting
73-
refresh-cookie:
74-
secure: false
75-
same-site: Lax
7672

7773
springdoc:
7874
swagger-ui:
@@ -106,6 +102,10 @@ app:
106102
oauth2:
107103
front-redirect-uri: "http://localhost:3000/auth/callback"
108104

105+
auth: # default cookie setting
106+
refresh-cookie:
107+
secure: false
108+
same-site: Lax
109109

110110
---
111111
# ==========================================
@@ -118,6 +118,10 @@ spring:
118118
app:
119119
oauth2:
120120
front-redirect-uri: "https://hangsha-dev.wafflestudio.com/auth/callback"
121+
auth:
122+
refresh-cookie:
123+
secure: true
124+
domain: ".wafflestudio.com"
121125
---
122126
# ==========================================
123127
# prod
@@ -128,4 +132,8 @@ spring:
128132
on-profile: prod
129133
app:
130134
oauth2:
131-
front-redirect-uri: "https://hangsha.wafflestudio.com/auth/callback"
135+
front-redirect-uri: "https://hangsha.wafflestudio.com/auth/callback"
136+
auth:
137+
refresh-cookie:
138+
secure: true
139+
domain: ".wafflestudio.com"

0 commit comments

Comments
 (0)