13
13
//===----------------------------------------------------------------------===//
14
14
15
15
extension KafkaConfiguration {
16
- // MARK: - SSLConfiguration
16
+ // MARK: - TLSConfiguration
17
17
18
- /// Use to configure an SSL connection.
19
- public struct SSLConfiguration : Sendable , Hashable {
18
+ /// Use to configure an TLS connection.
19
+ public struct TLSConfiguration : Sendable , Hashable {
20
20
/// Certificate chain consisting of one leaf certificate and potenentially multiple intermediate certificates.
21
21
/// The public key of the leaf certificate will be used for authentication.
22
22
public struct LeafAndIntermediates : Sendable , Hashable {
@@ -73,7 +73,7 @@ extension KafkaConfiguration {
73
73
}
74
74
}
75
75
76
- /// A SSL private key.
76
+ /// A TLS private key.
77
77
public struct PrivateKey : Sendable , Hashable {
78
78
public struct Location : Sendable , Hashable {
79
79
internal enum _Location : Sendable , Hashable {
@@ -109,7 +109,7 @@ extension KafkaConfiguration {
109
109
}
110
110
}
111
111
112
- /// A SSL key store (PKCS#12).
112
+ /// A TLS key store (PKCS#12).
113
113
public struct KeyStore : Sendable , Hashable {
114
114
/// Path to the key store.
115
115
public var location : String
@@ -122,7 +122,7 @@ extension KafkaConfiguration {
122
122
}
123
123
}
124
124
125
- internal enum _SSLConfiguration : Sendable , Hashable {
125
+ internal enum _TLSConfiguration : Sendable , Hashable {
126
126
case keyPair(
127
127
privateKey: PrivateKey ,
128
128
publicKeyCertificate: LeafAndIntermediates ,
@@ -136,9 +136,9 @@ extension KafkaConfiguration {
136
136
)
137
137
}
138
138
139
- let _internal : _SSLConfiguration
139
+ let _internal : _TLSConfiguration
140
140
141
- /// Use SSL with a given private/public key pair.
141
+ /// Use TLS with a given private/public key pair.
142
142
///
143
143
/// - Parameters:
144
144
///
@@ -151,8 +151,8 @@ extension KafkaConfiguration {
151
151
publicKeyCertificate: LeafAndIntermediates ,
152
152
caCertificate: RootCertificate = . probe,
153
153
crlLocation: String ?
154
- ) -> SSLConfiguration {
155
- return SSLConfiguration (
154
+ ) -> TLSConfiguration {
155
+ return TLSConfiguration (
156
156
_internal: . keyPair(
157
157
privateKey: privateKey,
158
158
publicKeyCertificate: publicKeyCertificate,
@@ -172,8 +172,8 @@ extension KafkaConfiguration {
172
172
keyStore: KeyStore ,
173
173
caCertificate: RootCertificate = . probe,
174
174
crlLocation: String ?
175
- ) -> SSLConfiguration {
176
- return SSLConfiguration (
175
+ ) -> TLSConfiguration {
176
+ return TLSConfiguration (
177
177
_internal: . keyStore(
178
178
keyStore: keyStore,
179
179
caCertificate: caCertificate,
@@ -182,7 +182,7 @@ extension KafkaConfiguration {
182
182
)
183
183
}
184
184
185
- // MARK: SSLConfiguration + Dictionary
185
+ // MARK: TLSConfiguration + Dictionary
186
186
187
187
internal var dictionary : [ String : String ] {
188
188
var resultDict : [ String : String ] = [ : ]
@@ -296,7 +296,7 @@ extension KafkaConfiguration {
296
296
/// For example: `principalClaimName=azp principal=admin scopeClaimName=roles scope=role1,role2 lifeSeconds=600`.
297
297
/// In addition, SASL extensions can be communicated to the broker via `extension_NAME=value`.
298
298
/// For example: `principal=admin extension_traceId=123`
299
- static func `default`( configuration: String ? = nil ) -> OAuthBearerMethod {
299
+ public static func `default`( configuration: String ? = nil ) -> OAuthBearerMethod {
300
300
return OAuthBearerMethod ( _internal: . default( configuration: configuration) )
301
301
}
302
302
@@ -319,7 +319,7 @@ extension KafkaConfiguration {
319
319
/// - scope: Client use this to specify the scope of the access request to the broker.
320
320
/// - extensions: Allow additional information to be provided to the broker.
321
321
/// Comma-separated list of key=value pairs. E.g., "supportFeatureX=true,organizationId=sales-emea".
322
- static func oidc(
322
+ public static func oidc(
323
323
configuration: String ? = nil ,
324
324
clientID: String ,
325
325
clientSecret: String ,
@@ -444,9 +444,9 @@ extension KafkaConfiguration {
444
444
public struct SecurityProtocol : Sendable , Hashable {
445
445
internal enum _SecurityProtocol : Sendable , Hashable {
446
446
case plaintext
447
- case ssl ( configuration: SSLConfiguration )
447
+ case tls ( configuration: TLSConfiguration )
448
448
case saslPlaintext( mechanism: SASLMechanism )
449
- case saslSSL ( saslMechanism: SASLMechanism , sslConfiguaration : SSLConfiguration )
449
+ case saslTLS ( saslMechanism: SASLMechanism , tlsConfiguaration : TLSConfiguration )
450
450
}
451
451
452
452
private let _internal : _SecurityProtocol
@@ -456,10 +456,10 @@ extension KafkaConfiguration {
456
456
_internal: . plaintext
457
457
)
458
458
459
- /// Use the Secure Sockets Layer (SSL ) protocol.
460
- public static func ssl ( configuration: SSLConfiguration ) -> SecurityProtocol {
459
+ /// Use the Transport Layer Security (TLS ) protocol.
460
+ public static func tls ( configuration: TLSConfiguration ) -> SecurityProtocol {
461
461
return SecurityProtocol (
462
- _internal: . ssl ( configuration: configuration)
462
+ _internal: . tls ( configuration: configuration)
463
463
)
464
464
}
465
465
@@ -470,13 +470,13 @@ extension KafkaConfiguration {
470
470
)
471
471
}
472
472
473
- /// Use the Simple Authentication and Security Layer (SASL) with SSL .
474
- public static func saslSSL (
473
+ /// Use the Simple Authentication and Security Layer (SASL) with TLS .
474
+ public static func saslTLS (
475
475
saslMechanism: SASLMechanism ,
476
- sslConfiguaration : SSLConfiguration
476
+ tlsConfiguaration : TLSConfiguration
477
477
) -> SecurityProtocol {
478
478
return SecurityProtocol (
479
- _internal: . saslSSL ( saslMechanism: saslMechanism, sslConfiguaration : sslConfiguaration )
479
+ _internal: . saslTLS ( saslMechanism: saslMechanism, tlsConfiguaration : tlsConfiguaration )
480
480
)
481
481
}
482
482
@@ -488,10 +488,10 @@ extension KafkaConfiguration {
488
488
switch self . _internal {
489
489
case . plaintext:
490
490
resultDict [ " security.protocol " ] = " plaintext "
491
- case . ssl ( let sslConfig ) :
491
+ case . tls ( let tlsConfig ) :
492
492
resultDict [ " security.protocol " ] = " ssl "
493
493
// Merge result dict with SASLMechanism config values
494
- resultDict. merge ( sslConfig . dictionary) { _, _ in
494
+ resultDict. merge ( tlsConfig . dictionary) { _, _ in
495
495
fatalError ( " Tried to override key that was already set! " )
496
496
}
497
497
case . saslPlaintext( let saslMechanism) :
@@ -500,13 +500,13 @@ extension KafkaConfiguration {
500
500
resultDict. merge ( saslMechanism. dictionary) { _, _ in
501
501
fatalError ( " Tried to override key that was already set! " )
502
502
}
503
- case . saslSSL ( let saslMechanism, let sslConfig ) :
503
+ case . saslTLS ( let saslMechanism, let tlsConfig ) :
504
504
resultDict [ " security.protocol " ] = " sasl_ssl "
505
505
// Merge with other dictionaries
506
506
resultDict. merge ( saslMechanism. dictionary) { _, _ in
507
507
fatalError ( " Tried to override key that was already set! " )
508
508
}
509
- resultDict. merge ( sslConfig . dictionary) { _, _ in
509
+ resultDict. merge ( tlsConfig . dictionary) { _, _ in
510
510
fatalError ( " Tried to override key that was already set! " )
511
511
}
512
512
}
0 commit comments