diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache index 0e3dba003ef0..c18b30352f05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/auth/HttpBasicAuth.kt.mustache @@ -1,6 +1,6 @@ package {{packageName}}.auth -import io.ktor.util.encodeBase64 +import kotlin.io.encoding.Base64 {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}class HttpBasicAuth : Authentication { {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}var username: String? = null @@ -9,7 +9,7 @@ import io.ktor.util.encodeBase64 override fun apply(query: MutableMap>, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") - val auth = str.encodeBase64() + val auth = Base64.encode(str.encodeToByteArray()) headers["Authorization"] = "Basic $auth" } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache index 0e3dba003ef0..c18b30352f05 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/auth/HttpBasicAuth.kt.mustache @@ -1,6 +1,6 @@ package {{packageName}}.auth -import io.ktor.util.encodeBase64 +import kotlin.io.encoding.Base64 {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}class HttpBasicAuth : Authentication { {{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}var username: String? = null @@ -9,7 +9,7 @@ import io.ktor.util.encodeBase64 override fun apply(query: MutableMap>, headers: MutableMap) { if (username == null && password == null) return val str = (username ?: "") + ":" + (password ?: "") - val auth = str.encodeBase64() + val auth = Base64.encode(str.encodeToByteArray()) headers["Authorization"] = "Basic $auth" } }