Skip to content

Commit ebfa094

Browse files
FranzBuschmimischi
andauthored
Remove curl dependency and disable OAuth Bearer SASL mechanism (#155)
# Motivation The curl dependency is just necessary for the OAuth Bearer SASL mechanism. Let's remove that configuration option for now. # Modification Removes the curl dependency. --------- Co-authored-by: Michael Gecht <[email protected]>
1 parent 09aca6b commit ebfa094

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

Diff for: Package.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ let rdkafkaExclude = [
2424
"./librdkafka/src/rdkafka_sasl_win32.c",
2525
"./librdkafka/src/rdwin32.h",
2626
"./librdkafka/src/win32_config.h",
27+
// Remove dependency on cURL. Disabling `ENABLE_CURL` and `WITH_CURL` does
28+
// not appear to prevent processing of the below files, so we have to exclude
29+
// them explicitly.
30+
"./librdkafka/src/rdkafka_sasl_oauthbearer.c",
31+
"./librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c",
32+
"./librdkafka/src/rdhttp.c",
2733
]
2834

2935
let package = Package(
@@ -72,7 +78,6 @@ let package = Package(
7278
.define("_GNU_SOURCE", to: "1"), // Fix build error for Swift 5.9 onwards
7379
],
7480
linkerSettings: [
75-
.linkedLibrary("curl"),
7681
.linkedLibrary("sasl2"),
7782
.linkedLibrary("z"), // zlib
7883
]

Diff for: Sources/Crdkafka/custom/config/config.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define ENABLE_ZSTD 1
2424
#define ENABLE_SSL 1
2525
#define ENABLE_GSSAPI 1
26-
#define ENABLE_CURL 1
26+
#define ENABLE_CURL 0
2727
#define ENABLE_DEVEL 0
2828
#define ENABLE_VALGRIND 0
2929
#define ENABLE_REFCNT_DEBUG 0
@@ -35,7 +35,6 @@
3535
#define ENABLE_ZSTD 1
3636
#define ENABLE_SSL 1
3737
#define ENABLE_GSSAPI 1
38-
#define ENABLE_CURL 1
3938
#define ENABLE_LZ4_EXT 1
4039
#define WITH_STATIC_LINKING 1
4140
#define MKL_APP_NAME "librdkafka"
@@ -136,7 +135,7 @@
136135
// libzstd
137136
#define WITH_ZSTD 1
138137
// libcurl
139-
#define WITH_CURL 1
138+
#define WITH_CURL 0
140139
// WITH_HDRHISTOGRAM
141140
#define WITH_HDRHISTOGRAM 1
142141
// WITH_SNAPPY
@@ -146,9 +145,9 @@
146145
// WITH_SASL_SCRAM
147146
#define WITH_SASL_SCRAM 1
148147
// WITH_SASL_OAUTHBEARER
149-
#define WITH_SASL_OAUTHBEARER 1
148+
#define WITH_SASL_OAUTHBEARER 0
150149
// WITH_OAUTHBEARER_OIDC
151-
#define WITH_OAUTHBEARER_OIDC 1
150+
#define WITH_OAUTHBEARER_OIDC 0
152151
// regex
153152
#define HAVE_REGEX 1
154153
// strndup

Diff for: Sources/Kafka/Configuration/KafkaConfiguration+Security.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ extension KafkaConfiguration {
309309
}
310310
}
311311

312-
public struct OAuthBearerMethod: Sendable, Hashable {
312+
struct OAuthBearerMethod: Sendable, Hashable {
313313
internal enum _OAuthBearerMethod: Sendable, Hashable {
314314
case `default`(
315315
configuration: String?
@@ -337,7 +337,7 @@ extension KafkaConfiguration {
337337
/// For example: `principalClaimName=azp principal=admin scopeClaimName=roles scope=role1,role2 lifeSeconds=600`.
338338
/// In addition, SASL extensions can be communicated to the broker via `extension_NAME=value`.
339339
/// For example: `principal=admin extension_traceId=123`
340-
public static func `default`(configuration: String? = nil) -> OAuthBearerMethod {
340+
static func `default`(configuration: String? = nil) -> OAuthBearerMethod {
341341
OAuthBearerMethod(_internal: .default(configuration: configuration))
342342
}
343343

@@ -359,7 +359,7 @@ extension KafkaConfiguration {
359359
/// - scope: The client uses this to specify the scope of the access request to the broker.
360360
/// - extensions: Allow additional information to be provided to the broker.
361361
/// Comma-separated list of key=value pairs. E.g., "supportFeatureX=true,organizationId=sales-emea".
362-
public static func oidc(
362+
static func oidc(
363363
configuration: String? = nil,
364364
clientID: String,
365365
clientSecret: String,
@@ -419,7 +419,8 @@ extension KafkaConfiguration {
419419
}
420420

421421
/// Use the OAUTHBEARER mechanism.
422-
public static func oAuthBearer(method: OAuthBearerMethod) -> SASLMechanism {
422+
// This is currently disabled since it requires a curl dependency otherwise.
423+
static func oAuthBearer(method: OAuthBearerMethod) -> SASLMechanism {
423424
SASLMechanism(
424425
_internal: .oAuthBearer(method: method)
425426
)

0 commit comments

Comments
 (0)