logstash-integration-kafka 11.5.4-java → 11.6.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aa0fa8dec3f2fd40ca01d9204dfbacb514635584e9dd36d2b6eb26df2920801
4
- data.tar.gz: b887f71474c06efbdf342c512fa6a37c14d8500fabb5a6cdd9c5373c2d7b192d
3
+ metadata.gz: 5dd14bd1f2219bc6c12f2e880648a3f5101a2735a0a6b5b223fd9c38b5979a6a
4
+ data.tar.gz: 80902b49827a7127b8b7b4e4e7266738624093cfed80d59fd4b840402df198c1
5
5
  SHA512:
6
- metadata.gz: 29297b83b191648c25a9cab409c0dd7b6182e517e6583a40ae5462a9bb249a47a7ef815a83579ea14dbc5207d3773f7e502a8af484340d1a48db66e5ccfeaf76
7
- data.tar.gz: e4b7b2334cb17197c11f5cabf140cc3e67e4d5d96203b11b5187411482a957236d292edda61868562823daf559bac89430c99d9a73c9ba4392f62d3830babd0f
6
+ metadata.gz: c9e51ace320c2c5505f9cce929e5b483e0d9d40193f4a629e337ddec7427fd9a1906b9cd9b4cdbf6a072a1add7ef85b7e8aa00035b1f983317559d3c832ce852
7
+ data.tar.gz: fd49cf285a490cc3b94371dadbca0301d7efea5e34348d908d5f84d4213a6ad77d4d4d0e96b7556518d60f71165af7054ce085eca4bf9c46be2bc95853c17e1c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 11.6.1
2
+ - Expose the SASL client callback class setting to the Logstash configuration [#177](https://github.com/logstash-plugins/logstash-integration-kafka/pull/177)
3
+ - Adds a mechanism to load AWS IAM authentication as SASL client libraries at startup [#178](https://github.com/logstash-plugins/logstash-integration-kafka/pull/178)
4
+
5
+ ## 11.6.0
6
+ - Support additional `oauth` and `sasl` configuration options for configuring kafka client [#189](https://github.com/logstash-plugins/logstash-integration-kafka/pull/189)
7
+
1
8
  ## 11.5.4
2
9
  - Update kafka client to 3.8.1 and transitive dependencies [#188](https://github.com/logstash-plugins/logstash-integration-kafka/pull/188)
3
10
  - Removed Jar Dependencies dependency [#187](https://github.com/logstash-plugins/logstash-integration-kafka/pull/187)
@@ -65,6 +65,23 @@ For more information see https://kafka.apache.org/{kafka_client_doc}/documentati
65
65
 
66
66
  Kafka consumer configuration: https://kafka.apache.org/{kafka_client_doc}/documentation.html#consumerconfigs
67
67
 
68
+ [id="plugins-{type}s-{plugin}-aws_msk_iam_auth"]
69
+ ==== AWS MSK IAM authentication
70
+ If you use AWS MSK, the AWS MSK IAM access control enables you to handle both authentication and authorization for your MSK cluster with AWS IAM.
71
+ For more information on this AWS MSK feature see the https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html[AWS documentation].
72
+
73
+ To use this Kafka input with AWS MSK IAM authentication, download the uber jar which contains the client library for
74
+ this specific cloud vendor and all the transitive dependencies from this https://github.com/elastic/logstash-kafka-iams-packages/releases[repository].
75
+ Configure the following setting:
76
+ ```
77
+ security_protocol => "SASL_SSL"
78
+ sasl_mechanism => "AWS_MSK_IAM"
79
+ sasl_iam_jar_paths => ["/path/to/aws_iam_uber.jar"]
80
+ sasl_jaas_config => "software.amazon.msk.auth.iam.IAMLoginModule required;"
81
+ sasl_client_callback_handler_class => "software.amazon.msk.auth.iam.IAMClientCallbackHandler"
82
+ ```
83
+ For more IAM authentication configurations, see the https://github.com/aws/aws-msk-iam-auth[AWS MSK IAM authentication library documentation].
84
+
68
85
  ==== Metadata fields
69
86
 
70
87
  The following metadata from Kafka broker are added under the `[@metadata]` field:
@@ -131,6 +148,14 @@ See the https://kafka.apache.org/{kafka_client_doc}/documentation for more detai
131
148
  | <<plugins-{type}s-{plugin}-request_timeout_ms>> |<<number,number>>|No
132
149
  | <<plugins-{type}s-{plugin}-retry_backoff_ms>> |<<number,number>>|No
133
150
  | <<plugins-{type}s-{plugin}-sasl_client_callback_handler_class>> |<<string,string>>|No
151
+ | <<plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url>> |<<string,string>>|No
152
+ | <<plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name>> |<<string,string>>|No
153
+ | <<plugins-{type}s-{plugin}-sasl_iam_jar_paths>> |<<array,array>>|No
154
+ | <<plugins-{type}s-{plugin}-sasl_login_callback_handler_class>> |<<string,string>>|No
155
+ | <<plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms>> |<<number,number>>|No
156
+ | <<plugins-{type}s-{plugin}-sasl_login_read_timeout_ms>> |<<number,number>>|No
157
+ | <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms>> |<<number,number>>|No
158
+ | <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms>> |<<number,number>>|No
134
159
  | <<plugins-{type}s-{plugin}-sasl_jaas_config>> |<<string,string>>|No
135
160
  | <<plugins-{type}s-{plugin}-sasl_kerberos_service_name>> |<<string,string>>|No
136
161
  | <<plugins-{type}s-{plugin}-sasl_mechanism>> |<<string,string>>|No
@@ -556,13 +581,70 @@ retries are exhausted.
556
581
  The amount of time to wait before attempting to retry a failed fetch request
557
582
  to a given topic partition. This avoids repeated fetching-and-failing in a tight loop.
558
583
 
559
- [id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class""]
584
+ [id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class"]
560
585
  ===== `sasl_client_callback_handler_class`
561
- * Value type is <<string,string>>
562
- * There is no default value for this setting.
586
+ * Value type is <<string,string>>
587
+ * There is no default value for this setting.
563
588
 
564
589
  The SASL client callback handler class the specified SASL mechanism should use.
565
590
 
591
+ [id="plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url"]
592
+ ===== `sasl_oauthbearer_token_endpoint_url`
593
+ * Value type is <<string,string>>
594
+ * There is no default value for this setting.
595
+
596
+ The URL for the OAuth 2.0 issuer token endpoint.
597
+
598
+ [id="plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name"]
599
+ ===== `sasl_oauthbearer_scope_claim_name`
600
+ * Value type is <<string,string>>
601
+ * Default value is `"scope"`
602
+
603
+ (optional) The override name of the scope claim.
604
+
605
+ [id="plugins-{type}s-{plugin}-sasl_iam_jar_paths"]
606
+ ===== `sasl_iam_jar_paths`
607
+ * Value type is <<arrays,array>>
608
+ * There is no default value for this setting.
609
+
610
+ Contains the list of paths to jar libraries that contains cloud providers MSK IAM's clients.
611
+ There is one jar per provider and can be retrieved as described in <<"plugins-{type}s-{plugin}-aws_msk_iam_auth">>.
612
+
613
+ [id="plugins-{type}s-{plugin}-sasl_login_callback_handler_class"]
614
+ ===== `sasl_login_callback_handler_class`
615
+ * Value type is <<string,string>>
616
+ * There is no default value for this setting.
617
+
618
+ The SASL login callback handler class the specified SASL mechanism should use.
619
+
620
+ [id="plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms"]
621
+ ===== `sasl_login_connect_timeout_ms`
622
+ * Value type is <<number,number>>
623
+ * There is no default value for this setting.
624
+
625
+ (optional) The duration, in milliseconds, for HTTPS connect timeout
626
+
627
+ [id="plugins-{type}s-{plugin}-sasl_login_read_timeout_ms"]
628
+ ===== `sasl_login_read_timeout_ms`
629
+ * Value type is <<number,number>>
630
+ * There is no default value for this setting.
631
+
632
+ (optional) The duration, in milliseconds, for HTTPS read timeout.
633
+
634
+ [id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms"]
635
+ ===== `sasl_login_retry_backoff_ms`
636
+ * Value type is <<number,number>>
637
+ * Default value is `100` milliseconds.
638
+
639
+ (optional) The duration, in milliseconds, to wait between HTTPS call attempts.
640
+
641
+ [id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms"]
642
+ ===== `sasl_login_retry_backoff_max_ms`
643
+ * Value type is <<number,number>>
644
+ * Default value is `10000` milliseconds.
645
+
646
+ (optional) The maximum duration, in milliseconds, for HTTPS call attempts.
647
+
566
648
  [id="plugins-{type}s-{plugin}-sasl_jaas_config"]
567
649
  ===== `sasl_jaas_config`
568
650
 
@@ -598,6 +680,7 @@ This can be defined either in Kafka's JAAS config or in Kafka's config.
598
680
 
599
681
  http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
600
682
  This may be any mechanism for which a security provider is available.
683
+ For AWS MSK IAM authentication use `AWS_MSK_IAM`.
601
684
  GSSAPI is the default mechanism.
602
685
 
603
686
  [id="plugins-{type}s-{plugin}-schema_registry_key"]
@@ -66,6 +66,23 @@ https://kafka.apache.org/{kafka_client_doc}/documentation.html#producerconfigs
66
66
 
67
67
  NOTE: This plugin does not support using a proxy when communicating to the Kafka broker.
68
68
 
69
+ [id="plugins-{type}s-{plugin}-aws_msk_iam_auth"]
70
+ ==== AWS MSK IAM authentication
71
+ If you use AWS MSK, the AWS MSK IAM access control enables you to handle both authentication and authorization for your MSK cluster with AWS IAM.
72
+ For more information on this AWS MSK feature see the https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html[AWS documentation].
73
+
74
+ To use this Kafka input with AWS MSK IAM authentication, download the uber jar which contains the client library for
75
+ this specific cloud vendor and all the transitive dependencies from this https://github.com/elastic/logstash-kafka-iams-packages/releases[repository].
76
+ Configure the following setting:
77
+ ```
78
+ security_protocol => "SASL_SSL"
79
+ sasl_mechanism => "AWS_MSK_IAM"
80
+ sasl_iam_jar_paths => ["/path/to/aws_iam_uber.jar"]
81
+ sasl_jaas_config => "software.amazon.msk.auth.iam.IAMLoginModule required;"
82
+ sasl_client_callback_handler_class => "software.amazon.msk.auth.iam.IAMClientCallbackHandler"
83
+ ```
84
+ For more IAM authentication configurations, see the https://github.com/aws/aws-msk-iam-auth[AWS MSK IAM authentication library documentation].
85
+
69
86
  [id="plugins-{type}s-{plugin}-options"]
70
87
  ==== Kafka Output Configuration Options
71
88
 
@@ -102,6 +119,14 @@ See the https://kafka.apache.org/{kafka_client_doc}/documentation for more detai
102
119
  | <<plugins-{type}s-{plugin}-retries>> |<<number,number>>|No
103
120
  | <<plugins-{type}s-{plugin}-retry_backoff_ms>> |<<number,number>>|No
104
121
  | <<plugins-{type}s-{plugin}-sasl_client_callback_handler_class>> |<<string,string>>|No
122
+ | <<plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url>> |<<string,string>>|No
123
+ | <<plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name>> |<<string,string>>|No
124
+ | <<plugins-{type}s-{plugin}-sasl_iam_jar_paths>> |<<array,array>>|No
125
+ | <<plugins-{type}s-{plugin}-sasl_login_callback_handler_class>> |<<string,string>>|No
126
+ | <<plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms>> |<<number,number>>|No
127
+ | <<plugins-{type}s-{plugin}-sasl_login_read_timeout_ms>> |<<number,number>>|No
128
+ | <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms>> |<<number,number>>|No
129
+ | <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms>> |<<number,number>>|No
105
130
  | <<plugins-{type}s-{plugin}-sasl_jaas_config>> |<<string,string>>|No
106
131
  | <<plugins-{type}s-{plugin}-sasl_kerberos_service_name>> |<<string,string>>|No
107
132
  | <<plugins-{type}s-{plugin}-sasl_mechanism>> |<<string,string>>|No
@@ -392,13 +417,70 @@ In versions prior to 10.5.0, any exception is retried indefinitely unless the `r
392
417
 
393
418
  The amount of time to wait before attempting to retry a failed produce request to a given topic partition.
394
419
 
395
- [id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class""]
420
+ [id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class"]
396
421
  ===== `sasl_client_callback_handler_class`
397
- * Value type is <<string,string>>
398
- * There is no default value for this setting.
422
+ * Value type is <<string,string>>
423
+ * There is no default value for this setting.
399
424
 
400
425
  The SASL client callback handler class the specified SASL mechanism should use.
401
426
 
427
+ [id="plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url"]
428
+ ===== `sasl_oauthbearer_token_endpoint_url`
429
+ * Value type is <<string,string>>
430
+ * There is no default value for this setting.
431
+
432
+ The URL for the OAuth 2.0 issuer token endpoint.
433
+
434
+ [id="plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name"]
435
+ ===== `sasl_oauthbearer_scope_claim_name`
436
+ * Value type is <<string,string>>
437
+ * Default value is `"scope"`
438
+
439
+ (optional) The override name of the scope claim.
440
+
441
+ [id="plugins-{type}s-{plugin}-sasl_iam_jar_paths"]
442
+ ===== `sasl_iam_jar_paths`
443
+ * Value type is <<arrays,array>>
444
+ * There is no default value for this setting.
445
+
446
+ Contains the list of paths to jar libraries that contains cloud providers MSK IAM's clients.
447
+ There is one jar per provider and can be retrieved as described in <<"plugins-{type}s-{plugin}-aws_msk_iam_auth">>.
448
+
449
+ [id="plugins-{type}s-{plugin}-sasl_login_callback_handler_class"]
450
+ ===== `sasl_login_callback_handler_class`
451
+ * Value type is <<string,string>>
452
+ * There is no default value for this setting.
453
+
454
+ The SASL login callback handler class the specified SASL mechanism should use.
455
+
456
+ [id="plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms"]
457
+ ===== `sasl_login_connect_timeout_ms`
458
+ * Value type is <<number,number>>
459
+ * There is no default value for this setting.
460
+
461
+ (optional) The duration, in milliseconds, for HTTPS connect timeout
462
+
463
+ [id="plugins-{type}s-{plugin}-sasl_login_read_timeout_ms"]
464
+ ===== `sasl_login_read_timeout_ms`
465
+ * Value type is <<number,number>>
466
+ * There is no default value for this setting.
467
+
468
+ (optional) The duration, in milliseconds, for HTTPS read timeout.
469
+
470
+ [id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms"]
471
+ ===== `sasl_login_retry_backoff_ms`
472
+ * Value type is <<number,number>>
473
+ * Default value is `100` milliseconds.
474
+
475
+ (optional) The duration, in milliseconds, to wait between HTTPS call attempts.
476
+
477
+ [id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms"]
478
+ ===== `sasl_login_retry_backoff_max_ms`
479
+ * Value type is <<number,number>>
480
+ * Default value is `10000` milliseconds.
481
+
482
+ (optional) The maximum duration, in milliseconds, for HTTPS call attempts.
483
+
402
484
  [id="plugins-{type}s-{plugin}-sasl_jaas_config"]
403
485
  ===== `sasl_jaas_config`
404
486
 
@@ -434,6 +516,7 @@ This can be defined either in Kafka's JAAS config or in Kafka's config.
434
516
 
435
517
  http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
436
518
  This may be any mechanism for which a security provider is available.
519
+ For AWS MSK IAM authentication use `AWS_MSK_IAM`.
437
520
  GSSAPI is the default mechanism.
438
521
 
439
522
  [id="plugins-{type}s-{plugin}-security_protocol"]
@@ -210,7 +210,23 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
210
210
  config :security_protocol, :validate => ["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"], :default => "PLAINTEXT"
211
211
  # SASL client callback handler class
212
212
  config :sasl_client_callback_handler_class, :validate => :string
213
- # http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
213
+ # The URL for the OAuth 2.0 issuer token endpoint.
214
+ config :sasl_oauthbearer_token_endpoint_url, :validate => :string
215
+ # (optional) The override name of the scope claim.
216
+ config :sasl_oauthbearer_scope_claim_name, :validate => :string, :default => 'scope' # Kafka default
217
+ # SASL login callback handler class
218
+ config :sasl_login_callback_handler_class, :validate => :string
219
+ # Path to the jar containing client and all dependencies for SASL IAM authentication of specific cloud vendor
220
+ config :sasl_iam_jar_paths, :validate => :array
221
+ # (optional) The duration, in milliseconds, for HTTPS connect timeout
222
+ config :sasl_login_connect_timeout_ms, :validate => :number
223
+ # (optional) The duration, in milliseconds, for HTTPS read timeout.
224
+ config :sasl_login_read_timeout_ms, :validate => :number
225
+ # (optional) The duration, in milliseconds, to wait between HTTPS call attempts.
226
+ config :sasl_login_retry_backoff_ms, :validate => :number, :default => 100 # Kafka default
227
+ # (optional) The maximum duration, in milliseconds, for HTTPS call attempts.
228
+ config :sasl_login_retry_backoff_max_ms, :validate => :number, :default => 10000 # Kafka default
229
+ # http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
214
230
  # This may be any mechanism for which a security provider is available.
215
231
  # GSSAPI is the default mechanism.
216
232
  config :sasl_mechanism, :validate => :string, :default => "GSSAPI"
@@ -149,6 +149,22 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
149
149
  config :security_protocol, :validate => ["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"], :default => "PLAINTEXT"
150
150
  # SASL client callback handler class
151
151
  config :sasl_client_callback_handler_class, :validate => :string
152
+ # Path to the jar containing client and all dependencies for SASL IAM authentication of specific cloud vendor
153
+ config :sasl_iam_jar_paths, :validate => :array
154
+ # The URL for the OAuth 2.0 issuer token endpoint.
155
+ config :sasl_oauthbearer_token_endpoint_url, :validate => :string
156
+ # (optional) The override name of the scope claim.
157
+ config :sasl_oauthbearer_scope_claim_name, :validate => :string, :default => 'scope' # Kafka default
158
+ # SASL login callback handler class
159
+ config :sasl_login_callback_handler_class, :validate => :string
160
+ # (optional) The duration, in milliseconds, for HTTPS connect timeout
161
+ config :sasl_login_connect_timeout_ms, :validate => :number
162
+ # (optional) The duration, in milliseconds, for HTTPS read timeout.
163
+ config :sasl_login_read_timeout_ms, :validate => :number
164
+ # (optional) The duration, in milliseconds, to wait between HTTPS call attempts.
165
+ config :sasl_login_retry_backoff_ms, :validate => :number, :default => 100 # Kafka default
166
+ # (optional) The maximum duration, in milliseconds, for HTTPS call attempts.
167
+ config :sasl_login_retry_backoff_max_ms, :validate => :number, :default => 10000 # Kafka default
152
168
  # http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
153
169
  # This may be any mechanism for which a security provider is available.
154
170
  # GSSAPI is the default mechanism.
@@ -42,6 +42,14 @@ module LogStash module PluginMixins module Kafka
42
42
  props.put("sasl.kerberos.service.name", sasl_kerberos_service_name) unless sasl_kerberos_service_name.nil?
43
43
  props.put("sasl.jaas.config", sasl_jaas_config) unless sasl_jaas_config.nil?
44
44
  props.put("sasl.client.callback.handler.class", sasl_client_callback_handler_class) unless sasl_client_callback_handler_class.nil?
45
+ props.put("sasl.oauthbearer.token.endpoint.url", sasl_oauthbearer_token_endpoint_url) unless sasl_oauthbearer_token_endpoint_url.nil?
46
+ props.put("sasl.oauthbearer.scope.claim.name", sasl_oauthbearer_scope_claim_name) unless sasl_oauthbearer_scope_claim_name.nil?
47
+ props.put("sasl.login.callback.handler.class", sasl_login_callback_handler_class) unless sasl_login_callback_handler_class.nil?
48
+ props.put("sasl.login.connect.timeout.ms", sasl_login_connect_timeout_ms.to_s) unless sasl_login_connect_timeout_ms.nil?
49
+ props.put("sasl.login.read.timeout.ms", sasl_login_read_timeout_ms.to_s) unless sasl_login_read_timeout_ms.nil?
50
+ props.put("sasl.login.retry.backoff.ms", sasl_login_retry_backoff_ms.to_s) unless sasl_login_retry_backoff_ms.nil?
51
+ props.put("sasl.login.retry.backoff.max.ms", sasl_login_retry_backoff_max_ms.to_s) unless sasl_login_retry_backoff_max_ms.nil?
52
+ sasl_iam_jar_paths&.each {|jar_path| require jar_path }
45
53
  end
46
54
 
47
55
  def reassign_dns_lookup
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-kafka'
3
- s.version = '11.5.4'
3
+ s.version = '11.6.1'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Integration with Kafka - input and output plugins"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
@@ -218,6 +218,54 @@ describe LogStash::Inputs::Kafka do
218
218
 
219
219
  end
220
220
 
221
+ context 'when oauth is configured' do
222
+ let(:config) { super().merge(
223
+ 'security_protocol' => 'SASL_PLAINTEXT',
224
+ 'sasl_mechanism' => 'OAUTHBEARER',
225
+ 'sasl_oauthbearer_token_endpoint_url' => 'https://auth.example.com/token',
226
+ 'sasl_oauthbearer_scope_claim_name' => 'custom_scope'
227
+ )}
228
+
229
+ it "sets oauth properties" do
230
+ expect(org.apache.kafka.clients.consumer.KafkaConsumer).
231
+ to receive(:new).with(hash_including(
232
+ 'security.protocol' => 'SASL_PLAINTEXT',
233
+ 'sasl.mechanism' => 'OAUTHBEARER',
234
+ 'sasl.oauthbearer.token.endpoint.url' => 'https://auth.example.com/token',
235
+ 'sasl.oauthbearer.scope.claim.name' => 'custom_scope'
236
+ )).and_return(kafka_client = double('kafka-consumer'))
237
+
238
+ expect(subject.send(:create_consumer, 'test-client-1', 'group_instance_id')).to be kafka_client
239
+ end
240
+ end
241
+
242
+ context 'when sasl is configured' do
243
+ let(:config) { super().merge(
244
+ 'security_protocol' => 'SASL_PLAINTEXT',
245
+ 'sasl_mechanism' => 'OAUTHBEARER',
246
+ 'sasl_login_connect_timeout_ms' => 15000,
247
+ 'sasl_login_read_timeout_ms' => 5000,
248
+ 'sasl_login_retry_backoff_ms' => 200,
249
+ 'sasl_login_retry_backoff_max_ms' => 15000,
250
+ 'sasl_login_callback_handler_class' => 'org.example.CustomLoginHandler'
251
+ )}
252
+
253
+ it "sets sasl login properties" do
254
+ expect(org.apache.kafka.clients.consumer.KafkaConsumer).
255
+ to receive(:new).with(hash_including(
256
+ 'security.protocol' => 'SASL_PLAINTEXT',
257
+ 'sasl.mechanism' => 'OAUTHBEARER',
258
+ 'sasl.login.connect.timeout.ms' => '15000',
259
+ 'sasl.login.read.timeout.ms' => '5000',
260
+ 'sasl.login.retry.backoff.ms' => '200',
261
+ 'sasl.login.retry.backoff.max.ms' => '15000',
262
+ 'sasl.login.callback.handler.class' => 'org.example.CustomLoginHandler'
263
+ )).and_return(kafka_client = double('kafka-consumer'))
264
+
265
+ expect(subject.send(:create_consumer, 'test-client-2', 'group_instance_id')).to be kafka_client
266
+ end
267
+ end
268
+
221
269
  describe "schema registry" do
222
270
  let(:base_config) do {
223
271
  'schema_registry_url' => 'http://localhost:8081',
@@ -9,6 +9,7 @@ describe "outputs/kafka" do
9
9
  '@timestamp' => LogStash::Timestamp.now}) }
10
10
 
11
11
  let(:future) { double('kafka producer future') }
12
+ subject { LogStash::Outputs::Kafka.new(config) }
12
13
 
13
14
  context 'when initializing' do
14
15
  it "should register" do
@@ -267,8 +268,6 @@ describe "outputs/kafka" do
267
268
  File.join(File.dirname(__FILE__), '../../fixtures/trust-store_stub.jks')
268
269
  end
269
270
 
270
- subject { LogStash::Outputs::Kafka.new(config) }
271
-
272
271
  it 'sets empty ssl.endpoint.identification.algorithm' do
273
272
  expect(org.apache.kafka.clients.producer.KafkaProducer).
274
273
  to receive(:new).with(hash_including('ssl.endpoint.identification.algorithm' => ''))
@@ -283,4 +282,53 @@ describe "outputs/kafka" do
283
282
 
284
283
  end
285
284
 
285
+ context 'when oauth is configured' do
286
+ let(:config) {
287
+ simple_kafka_config.merge(
288
+ 'security_protocol' => 'SASL_PLAINTEXT',
289
+ 'sasl_mechanism' => 'OAUTHBEARER',
290
+ 'sasl_oauthbearer_token_endpoint_url' => 'https://auth.example.com/token',
291
+ 'sasl_oauthbearer_scope_claim_name' => 'custom_scope'
292
+ )
293
+ }
294
+
295
+ it "sets oauth properties" do
296
+ expect(org.apache.kafka.clients.producer.KafkaProducer).
297
+ to receive(:new).with(hash_including(
298
+ 'security.protocol' => 'SASL_PLAINTEXT',
299
+ 'sasl.mechanism' => 'OAUTHBEARER',
300
+ 'sasl.oauthbearer.token.endpoint.url' => 'https://auth.example.com/token',
301
+ 'sasl.oauthbearer.scope.claim.name' => 'custom_scope'
302
+ ))
303
+ subject.register
304
+ end
305
+ end
306
+
307
+ context 'when sasl is configured' do
308
+ let(:config) {
309
+ simple_kafka_config.merge(
310
+ 'security_protocol' => 'SASL_PLAINTEXT',
311
+ 'sasl_mechanism' => 'OAUTHBEARER',
312
+ 'sasl_login_connect_timeout_ms' => 15000,
313
+ 'sasl_login_read_timeout_ms' => 5000,
314
+ 'sasl_login_retry_backoff_ms' => 200,
315
+ 'sasl_login_retry_backoff_max_ms' => 15000,
316
+ 'sasl_login_callback_handler_class' => 'org.example.CustomLoginHandler'
317
+ )
318
+ }
319
+
320
+ it "sets sasl login properties" do
321
+ expect(org.apache.kafka.clients.producer.KafkaProducer).
322
+ to receive(:new).with(hash_including(
323
+ 'security.protocol' => 'SASL_PLAINTEXT',
324
+ 'sasl.mechanism' => 'OAUTHBEARER',
325
+ 'sasl.login.connect.timeout.ms' => '15000',
326
+ 'sasl.login.read.timeout.ms' => '5000',
327
+ 'sasl.login.retry.backoff.ms' => '200',
328
+ 'sasl.login.retry.backoff.max.ms' => '15000',
329
+ 'sasl.login.callback.handler.class' => 'org.example.CustomLoginHandler'
330
+ ))
331
+ subject.register
332
+ end
333
+ end
286
334
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.5.4
4
+ version: 11.6.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement