@@ -4,6 +4,7 @@ import org.gitanimals.core.HttpClientErrorHandler
4
4
import org.gitanimals.core.auth.InternalAuthRequestInterceptor
5
5
import org.gitanimals.core.filter.MDCFilter
6
6
import org.slf4j.MDC
7
+ import org.springframework.beans.factory.annotation.Value
7
8
import org.springframework.context.annotation.Bean
8
9
import org.springframework.context.annotation.Configuration
9
10
import org.springframework.context.annotation.Profile
@@ -14,6 +15,7 @@ import org.springframework.web.service.invoker.HttpServiceProxyFactory
14
15
@Configuration
15
16
@Profile(" !test" )
16
17
class SupportsOrchestrateHttpClientConfigurer (
18
+ @Value(" \$ {internal.secret}" ) private val internalSecret : String ,
17
19
private val internalAuthRequestInterceptor : InternalAuthRequestInterceptor ,
18
20
) {
19
21
@@ -23,6 +25,9 @@ class SupportsOrchestrateHttpClientConfigurer(
23
25
.builder()
24
26
.requestInterceptor { request, body, execution ->
25
27
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
+ }
26
31
execution.execute(request, body)
27
32
}
28
33
.requestInterceptor(internalAuthRequestInterceptor)
@@ -40,6 +45,10 @@ class SupportsOrchestrateHttpClientConfigurer(
40
45
@Bean
41
46
fun supportsOrchestrateHttpClientErrorHandler (): HttpClientErrorHandler =
42
47
HttpClientErrorHandler ()
48
+
49
+ private companion object {
50
+ private const val INTERNAL_SECRET_KEY = " Internal-Secret"
51
+ }
43
52
}
44
53
45
54
@Configuration
0 commit comments