Skip to content

Commit 6d45a94

Browse files
author
darby.han
committed
Add missing oauth config (#180)
1 parent 7786c5e commit 6d45a94

File tree

5 files changed

+132
-6
lines changed

5 files changed

+132
-6
lines changed

docs/input-kafka.asciidoc

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ See the https://kafka.apache.org/{kafka_client_doc}/documentation for more detai
131131
| <<plugins-{type}s-{plugin}-request_timeout_ms>> |<<number,number>>|No
132132
| <<plugins-{type}s-{plugin}-retry_backoff_ms>> |<<number,number>>|No
133133
| <<plugins-{type}s-{plugin}-sasl_client_callback_handler_class>> |<<string,string>>|No
134+
| <<plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url>> |<<string,string>>|No
135+
| <<plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name>> |<<string,string>>|No
136+
| <<plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms>> |<<number,number>>|No
137+
| <<plugins-{type}s-{plugin}-sasl_login_read_timeout_ms>> |<<number,number>>|No
138+
| <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms>> |<<number,number>>|No
139+
| <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms>> |<<number,number>>|No
134140
| <<plugins-{type}s-{plugin}-sasl_jaas_config>> |<<string,string>>|No
135141
| <<plugins-{type}s-{plugin}-sasl_kerberos_service_name>> |<<string,string>>|No
136142
| <<plugins-{type}s-{plugin}-sasl_mechanism>> |<<string,string>>|No
@@ -556,13 +562,55 @@ retries are exhausted.
556562
The amount of time to wait before attempting to retry a failed fetch request
557563
to a given topic partition. This avoids repeated fetching-and-failing in a tight loop.
558564

559-
[id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class""]
565+
[id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class"]
560566
===== `sasl_client_callback_handler_class`
561-
* Value type is <<string,string>>
562-
* There is no default value for this setting.
567+
* Value type is <<string,string>>
568+
* There is no default value for this setting.
563569

564570
The SASL client callback handler class the specified SASL mechanism should use.
565571

572+
[id="plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url"]
573+
===== `sasl_oauthbearer_token_endpoint_url`
574+
* Value type is <<string,string>>
575+
* There is no default value for this setting.
576+
577+
The URL for the OAuth 2.0 issuer token endpoint.
578+
579+
[id="plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name"]
580+
===== `sasl_oauthbearer_scope_claim_name`
581+
* Value type is <<string,string>>
582+
* Default value is `"scope"`
583+
584+
(optional) The override name of the scope claim.
585+
586+
[id="plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms"]
587+
===== `sasl_login_connect_timeout_ms`
588+
* Value type is <<number,number>>
589+
* Default value is `10000` milliseconds.
590+
591+
(optional) The duration, in milliseconds, for HTTPS connect timeout
592+
593+
[id="plugins-{type}s-{plugin}-sasl_login_read_timeout_ms"]
594+
===== `sasl_login_read_timeout_ms`
595+
* Value type is <<number,number>>
596+
* Default value is `10000` milliseconds.
597+
598+
(optional) The duration, in milliseconds, for HTTPS read timeout.
599+
600+
[id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms"]
601+
===== `sasl_login_retry_backoff_ms`
602+
* Value type is <<number,number>>
603+
* Default value is `100` milliseconds.
604+
605+
(optional) The duration, in milliseconds, to wait between HTTPS call attempts.
606+
607+
[id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms"]
608+
===== `sasl_login_retry_backoff_max_ms`
609+
* Value type is <<number,number>>
610+
* Default value is `10000` milliseconds.
611+
612+
(optional) The maximum duration, in milliseconds, for HTTPS call attempts.
613+
566614
[id="plugins-{type}s-{plugin}-sasl_jaas_config"]
567615
===== `sasl_jaas_config`
568616

docs/output-kafka.asciidoc

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ See the https://kafka.apache.org/{kafka_client_doc}/documentation for more detai
102102
| <<plugins-{type}s-{plugin}-retries>> |<<number,number>>|No
103103
| <<plugins-{type}s-{plugin}-retry_backoff_ms>> |<<number,number>>|No
104104
| <<plugins-{type}s-{plugin}-sasl_client_callback_handler_class>> |<<string,string>>|No
105+
| <<plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url>> |<<string,string>>|No
106+
| <<plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name>> |<<string,string>>|No
107+
| <<plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms>> |<<number,number>>|No
108+
| <<plugins-{type}s-{plugin}-sasl_login_read_timeout_ms>> |<<number,number>>|No
109+
| <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms>> |<<number,number>>|No
110+
| <<plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms>> |<<number,number>>|No
105111
| <<plugins-{type}s-{plugin}-sasl_jaas_config>> |<<string,string>>|No
106112
| <<plugins-{type}s-{plugin}-sasl_kerberos_service_name>> |<<string,string>>|No
107113
| <<plugins-{type}s-{plugin}-sasl_mechanism>> |<<string,string>>|No
@@ -392,13 +398,55 @@ In versions prior to 10.5.0, any exception is retried indefinitely unless the `r
392398

393399
The amount of time to wait before attempting to retry a failed produce request to a given topic partition.
394400

395-
[id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class""]
401+
[id="plugins-{type}s-{plugin}-sasl_client_callback_handler_class"]
396402
===== `sasl_client_callback_handler_class`
397-
* Value type is <<string,string>>
398-
* There is no default value for this setting.
403+
* Value type is <<string,string>>
404+
* There is no default value for this setting.
399405

400406
The SASL client callback handler class the specified SASL mechanism should use.
401407

408+
[id="plugins-{type}s-{plugin}-sasl_oauthbearer_token_endpoint_url"]
409+
===== `sasl_oauthbearer_token_endpoint_url`
410+
* Value type is <<string,string>>
411+
* There is no default value for this setting.
412+
413+
The URL for the OAuth 2.0 issuer token endpoint.
414+
415+
[id="plugins-{type}s-{plugin}-sasl_oauthbearer_scope_claim_name"]
416+
===== `sasl_oauthbearer_scope_claim_name`
417+
* Value type is <<string,string>>
418+
* Default value is `"scope"`
419+
420+
(optional) The override name of the scope claim.
421+
422+
[id="plugins-{type}s-{plugin}-sasl_login_connect_timeout_ms"]
423+
===== `sasl_login_connect_timeout_ms`
424+
* Value type is <<number,number>>
425+
* Default value is `10000` milliseconds.
426+
427+
(optional) The duration, in milliseconds, for HTTPS connect timeout
428+
429+
[id="plugins-{type}s-{plugin}-sasl_login_read_timeout_ms"]
430+
===== `sasl_login_read_timeout_ms`
431+
* Value type is <<number,number>>
432+
* Default value is `10000` milliseconds.
433+
434+
(optional) The duration, in milliseconds, for HTTPS read timeout.
435+
436+
[id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_ms"]
437+
===== `sasl_login_retry_backoff_ms`
438+
* Value type is <<number,number>>
439+
* Default value is `100` milliseconds.
440+
441+
(optional) The duration, in milliseconds, to wait between HTTPS call attempts.
442+
443+
[id="plugins-{type}s-{plugin}-sasl_login_retry_backoff_max_ms"]
444+
===== `sasl_login_retry_backoff_max_ms`
445+
* Value type is <<number,number>>
446+
* Default value is `10000` milliseconds.
447+
448+
(optional) The maximum duration, in milliseconds, for HTTPS call attempts.
449+
402450
[id="plugins-{type}s-{plugin}-sasl_jaas_config"]
403451
===== `sasl_jaas_config`
404452

lib/logstash/inputs/kafka.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
210210
config :security_protocol, :validate => ["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"], :default => "PLAINTEXT"
211211
# SASL client callback handler class
212212
config :sasl_client_callback_handler_class, :validate => :string
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'
217+
# (optional) The duration, in milliseconds, for HTTPS connect timeout
218+
config :sasl_login_connect_timeout_ms, :validate => :number, :default => 10000
219+
# (optional) The duration, in milliseconds, for HTTPS read timeout.
220+
config :sasl_login_read_timeout_ms, :validate => :number, :default => 10000
221+
# (optional) The duration, in milliseconds, to wait between HTTPS call attempts.
222+
config :sasl_login_retry_backoff_ms, :validate => :number, :default => 100
223+
# (optional) The maximum duration, in milliseconds, for HTTPS call attempts.
224+
config :sasl_login_retry_backoff_max_ms, :validate => :number, :default => 10000
213225
# http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
214226
# This may be any mechanism for which a security provider is available.
215227
# GSSAPI is the default mechanism.

lib/logstash/outputs/kafka.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ class LogStash::Outputs::Kafka < LogStash::Outputs::Base
149149
config :security_protocol, :validate => ["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"], :default => "PLAINTEXT"
150150
# SASL client callback handler class
151151
config :sasl_client_callback_handler_class, :validate => :string
152+
# The URL for the OAuth 2.0 issuer token endpoint.
153+
config :sasl_oauthbearer_token_endpoint_url, :validate => :string
154+
# (optional) The override name of the scope claim.
155+
config :sasl_oauthbearer_scope_claim_name, :validate => :string, :default => 'scope'
156+
# (optional) The duration, in milliseconds, for HTTPS connect timeout
157+
config :sasl_login_connect_timeout_ms, :validate => :number, :default => 10000
158+
# (optional) The duration, in milliseconds, for HTTPS read timeout.
159+
config :sasl_login_read_timeout_ms, :validate => :number, :default => 10000
160+
# (optional) The duration, in milliseconds, to wait between HTTPS call attempts.
161+
config :sasl_login_retry_backoff_ms, :validate => :number, :default => 100
162+
# (optional) The maximum duration, in milliseconds, for HTTPS call attempts.
163+
config :sasl_login_retry_backoff_max_ms, :validate => :number, :default => 10000
152164
# http://kafka.apache.org/documentation.html#security_sasl[SASL mechanism] used for client connections.
153165
# This may be any mechanism for which a security provider is available.
154166
# GSSAPI is the default mechanism.

lib/logstash/plugin_mixins/kafka/common.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def set_sasl_config(props)
4242
props.put("sasl.kerberos.service.name", sasl_kerberos_service_name) unless sasl_kerberos_service_name.nil?
4343
props.put("sasl.jaas.config", sasl_jaas_config) unless sasl_jaas_config.nil?
4444
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.connect.timeout.ms", sasl_login_connect_timeout_ms.to_s) unless sasl_login_connect_timeout_ms.nil?
48+
props.put("sasl.login.read.timeout.ms", sasl_login_read_timeout_ms.to_s) unless sasl_login_read_timeout_ms.nil?
49+
props.put("sasl.login.retry.backoff.ms", sasl_login_retry_backoff_ms.to_s) unless sasl_login_retry_backoff_ms.nil?
50+
props.put("sasl.login.retry.backoff.max.ms", sasl_login_retry_backoff_max_ms.to_s) unless sasl_login_retry_backoff_max_ms.nil?
4551
end
4652

4753
def reassign_dns_lookup

0 commit comments

Comments
 (0)