feat(ai-character): 관리자 API Phase 1 기반을 추가한다
This commit is contained in:
@@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.configs
|
||||
import kr.co.vividnext.sodalive.common.CountryInterceptor
|
||||
import kr.co.vividnext.sodalive.i18n.LangInterceptor
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.web.cors.CorsConfiguration
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||
@@ -18,15 +19,49 @@ class WebConfig(
|
||||
}
|
||||
|
||||
override fun addCorsMappings(registry: CorsRegistry) {
|
||||
listOf("/admin/member/login", "/member/logout").forEach { path ->
|
||||
registry.addMapping(path)
|
||||
.allowedOrigins(*AI_CHARACTER_ADMIN_SHARED_AUTH_ALLOWED_ORIGINS.toTypedArray())
|
||||
.allowedMethods("*")
|
||||
.allowCredentials(true)
|
||||
}
|
||||
|
||||
registry.addMapping("/api/v2/admin/ai-characters/**")
|
||||
.allowedOrigins(*AI_CHARACTER_ADMIN_ALLOWED_ORIGINS.toTypedArray())
|
||||
.allowedMethods("*")
|
||||
.allowCredentials(true)
|
||||
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins(
|
||||
"http://localhost:8888",
|
||||
"https://creator.sodalive.net",
|
||||
"https://test-creator.sodalive.net",
|
||||
"https://test-admin.sodalive.net",
|
||||
"https://admin.sodalive.net"
|
||||
)
|
||||
.allowedOrigins(*ALLOWED_ORIGINS.toTypedArray())
|
||||
.allowedMethods("*")
|
||||
.allowCredentials(true)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val ALLOWED_ORIGINS = listOf(
|
||||
"http://localhost:8888",
|
||||
"https://creator.sodalive.net",
|
||||
"https://test-creator.sodalive.net",
|
||||
"https://test-admin.sodalive.net",
|
||||
"https://admin.sodalive.net"
|
||||
)
|
||||
|
||||
private val AI_CHARACTER_ADMIN_ALLOWED_ORIGINS = listOf(
|
||||
"http://localhost:8888",
|
||||
"https://test-character-admin.sodalive.net",
|
||||
"https://character-admin.sodalive.net"
|
||||
)
|
||||
|
||||
private val AI_CHARACTER_ADMIN_SHARED_AUTH_ALLOWED_ORIGINS =
|
||||
(ALLOWED_ORIGINS + AI_CHARACTER_ADMIN_ALLOWED_ORIGINS).distinct()
|
||||
|
||||
internal fun createAiCharacterAdminCorsConfiguration(): CorsConfiguration {
|
||||
return CorsConfiguration().apply {
|
||||
applyPermitDefaultValues()
|
||||
allowedOrigins = AI_CHARACTER_ADMIN_ALLOWED_ORIGINS
|
||||
allowedMethods = listOf(CorsConfiguration.ALL)
|
||||
allowCredentials = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user