@@ -4,6 +4,7 @@ import org.gitanimals.core.HttpClientErrorHandler
44import org.gitanimals.core.auth.InternalAuthRequestInterceptor
55import org.gitanimals.core.filter.MDCFilter
66import org.slf4j.MDC
7+ import org.springframework.beans.factory.annotation.Value
78import org.springframework.context.annotation.Bean
89import org.springframework.context.annotation.Configuration
910import org.springframework.context.annotation.Profile
@@ -14,6 +15,7 @@ import org.springframework.web.service.invoker.HttpServiceProxyFactory
1415@Configuration
1516@Profile(" !test" )
1617class SupportsOrchestrateHttpClientConfigurer (
18+ @Value(" \$ {internal.secret}" ) private val internalSecret : String ,
1719 private val internalAuthRequestInterceptor : InternalAuthRequestInterceptor ,
1820) {
1921
@@ -23,6 +25,9 @@ class SupportsOrchestrateHttpClientConfigurer(
2325 .builder()
2426 .requestInterceptor { request, body, execution ->
2527 request.headers.add(MDCFilter .TRACE_ID , MDC .get(MDCFilter .TRACE_ID ))
28+ if (request.uri.path.startsWith(" /internals" )) {
29+ request.headers.add(INTERNAL_SECRET_KEY , internalSecret)
30+ }
2631 execution.execute(request, body)
2732 }
2833 .requestInterceptor(internalAuthRequestInterceptor)
@@ -40,6 +45,10 @@ class SupportsOrchestrateHttpClientConfigurer(
4045 @Bean
4146 fun supportsOrchestrateHttpClientErrorHandler (): HttpClientErrorHandler =
4247 HttpClientErrorHandler ()
48+
49+ private companion object {
50+ private const val INTERNAL_SECRET_KEY = " Internal-Secret"
51+ }
4352}
4453
4554@Configuration
0 commit comments