From 6da196fda741ae0f8c85e4bca787d6488038af0e Mon Sep 17 00:00:00 2001 From: Brutus5000 Date: Fri, 29 Nov 2024 10:51:18 +0100 Subject: [PATCH] Add session id to cloudflare CredentialRequest --- .../icebreaker/service/cloudflare/CloudflareApiClient.kt | 2 +- .../service/cloudflare/CloudflareSessionHandler.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareApiClient.kt b/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareApiClient.kt index 95d4ea7..e437ba4 100644 --- a/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareApiClient.kt +++ b/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareApiClient.kt @@ -13,7 +13,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient @Consumes(MediaType.APPLICATION_JSON) interface CloudflareApiClient { - data class CredentialRequest(val ttl: Long) + data class CredentialRequest(val ttl: Long, val customIdentifier: String?) data class CredentialResponse(val iceServers: IceServers) { data class IceServers(val urls: List, val username: String, val credential: String) } diff --git a/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareSessionHandler.kt b/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareSessionHandler.kt index d2a0653..858bda3 100644 --- a/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareSessionHandler.kt +++ b/src/main/kotlin/com/faforever/icebreaker/service/cloudflare/CloudflareSessionHandler.kt @@ -31,7 +31,10 @@ class CloudflareSessionHandler( override fun getIceServersSession(sessionId: String): List = cloudflareApiAdapter.requestIceServers( - credentialRequest = CloudflareApiClient.CredentialRequest(ttl = fafProperties.tokenLifetimeSeconds()), + credentialRequest = CloudflareApiClient.CredentialRequest( + ttl = fafProperties.tokenLifetimeSeconds(), + customIdentifier = sessionId, + ), ).let { listOf( Session.Server(