revert(ai-character): 기존 관리자 기능 기반을 제거한다

This commit is contained in:
2026-07-23 16:47:00 +09:00
parent a0bf71be47
commit d3564f8c0d
40 changed files with 83 additions and 11634 deletions

View File

@@ -6,9 +6,6 @@ import kr.co.vividnext.sodalive.jwt.JwtAccessDeniedHandler
import kr.co.vividnext.sodalive.jwt.JwtAuthenticationEntryPoint
import kr.co.vividnext.sodalive.jwt.JwtFilter
import kr.co.vividnext.sodalive.jwt.TokenProvider
import kr.co.vividnext.sodalive.v2.admin.aicharacter.adapter.`in`.security.AiCharacterAdminAccessDeniedHandler
import kr.co.vividnext.sodalive.v2.admin.aicharacter.adapter.`in`.security.AiCharacterAdminAuthenticationEntryPoint
import org.springframework.beans.factory.ObjectProvider
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpMethod
@@ -30,9 +27,7 @@ class SecurityConfig(
private val objectMapper: ObjectMapper,
private val tokenProvider: TokenProvider,
private val accessDeniedHandler: JwtAccessDeniedHandler,
private val authenticationEntryPoint: JwtAuthenticationEntryPoint,
private val aiCharacterAdminAuthenticationEntryPoint: ObjectProvider<AiCharacterAdminAuthenticationEntryPoint>,
private val aiCharacterAdminAccessDeniedHandler: ObjectProvider<AiCharacterAdminAccessDeniedHandler>
private val authenticationEntryPoint: JwtAuthenticationEntryPoint
) {
@Bean
fun passwordEncoder(): PasswordEncoder {
@@ -57,22 +52,8 @@ class SecurityConfig(
.and()
.csrf().disable()
.exceptionHandling()
.authenticationEntryPoint { request, response, authException ->
val adminEntryPoint = aiCharacterAdminAuthenticationEntryPoint.getIfAvailable()
if (isAiCharacterAdminPath(request.requestURI) && adminEntryPoint != null) {
adminEntryPoint.commence(request, response, authException)
} else {
authenticationEntryPoint.commence(request, response, authException)
}
}
.accessDeniedHandler { request, response, accessDeniedException ->
val adminAccessDeniedHandler = aiCharacterAdminAccessDeniedHandler.getIfAvailable()
if (isAiCharacterAdminPath(request.requestURI) && adminAccessDeniedHandler != null) {
adminAccessDeniedHandler.handle(request, response, accessDeniedException)
} else {
accessDeniedHandler.handle(request, response, accessDeniedException)
}
}
.authenticationEntryPoint(authenticationEntryPoint)
.accessDeniedHandler(accessDeniedHandler)
.and()
.headers()
.frameOptions()
@@ -119,7 +100,6 @@ class SecurityConfig(
.antMatchers(HttpMethod.GET, "/api/chat/character/main").permitAll()
.antMatchers(HttpMethod.GET, "/api/chat/room/list").permitAll()
.antMatchers(HttpMethod.GET, "/api/chat/original/list").permitAll()
.antMatchers(HttpMethod.PUT, "/audio-content/upload-complete").hasAnyRole("ADMIN", "BOT")
.antMatchers(HttpMethod.POST, "/charge/payverse/webhook").permitAll()
.antMatchers(HttpMethod.GET, "/api/v2/home/recommendations").permitAll()
.antMatchers(HttpMethod.GET, "/api/v2/audio/recommendations").permitAll()
@@ -130,17 +110,8 @@ class SecurityConfig(
.antMatchers(HttpMethod.GET, "/api/v2/home/on-air-lives").authenticated()
// 페이지네이션 하위 경로(/lives, /debut-creators 등)는 인증 필수
.antMatchers(HttpMethod.GET, "/api/v2/home/recommendations/**").authenticated()
.antMatchers(AI_CHARACTER_ADMIN_PATH_PREFIX, "$AI_CHARACTER_ADMIN_PATH_PREFIX/**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.build()
}
private fun isAiCharacterAdminPath(requestUri: String): Boolean {
return requestUri == AI_CHARACTER_ADMIN_PATH_PREFIX || requestUri.startsWith("$AI_CHARACTER_ADMIN_PATH_PREFIX/")
}
companion object {
private const val AI_CHARACTER_ADMIN_PATH_PREFIX = "/admin/ai-characters"
}
}