From 6aaf075208354117afc95fd180ec0e8c4f9b41c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vandendaelen?= Date: Sat, 25 May 2024 16:09:30 +0200 Subject: [PATCH] Added token as a query parameter to embed file --- src/main/kotlin/be/vandeas/plugins/Routing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/be/vandeas/plugins/Routing.kt b/src/main/kotlin/be/vandeas/plugins/Routing.kt index 278a97a..c1693a8 100644 --- a/src/main/kotlin/be/vandeas/plugins/Routing.kt +++ b/src/main/kotlin/be/vandeas/plugins/Routing.kt @@ -70,7 +70,7 @@ fun Application.configureRouting() { get("/embed/{path}/{fileName}") { val path = call.parameters["path"] ?: "" val fileName = call.parameters["fileName"] ?: "" - val authorization = call.request.authorization() ?: throw IllegalArgumentException("Authorization header is required") + val authorization = call.request.queryParameters["token"] ?: call.request.authorization() ?: throw IllegalArgumentException("Authorization header is required") if (path.isBlank() || fileName.isBlank()) { call.respond(HttpStatusCode.BadRequest, mapOf("path" to path, "fileName" to fileName))