From ae0f0e48475bbcc2b582881bb2689ed1c2badc0d Mon Sep 17 00:00:00 2001 From: Pere Urbon-Bayes Date: Tue, 1 Dec 2015 15:21:02 +0100 Subject: [PATCH 1/2] add proxy authentication credentials to the twitter api configuration --- lib/logstash/inputs/twitter.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/logstash/inputs/twitter.rb b/lib/logstash/inputs/twitter.rb index 313250d..23aa2f1 100644 --- a/lib/logstash/inputs/twitter.rb +++ b/lib/logstash/inputs/twitter.rb @@ -98,6 +98,12 @@ class LogStash::Inputs::Twitter < LogStash::Inputs::Base # Port where the proxy is listening, by default 3128 (squid) config :proxy_port, :validate => :number, :default => 3128 + # Proxy username to be used when performing authentication + config :proxy_username, :validate => :string + + # Proxy password to be used when authenticating + config :proxy_password, :validate => :password + def register require "twitter" @@ -208,8 +214,10 @@ def configure(c) if @use_proxy c.proxy = { proxy_address: @proxy_address, - proxy_port: @proxy_port, + proxy_port: @proxy_port } + c.proxy[:proxy_username] = @proxy_username if @proxy_username + c.proxy[:proxy_password] = @proxy_password if @proxy_password end end From 7433c21eea956ad631816ac5526ce4dce8e52c86 Mon Sep 17 00:00:00 2001 From: Pere Urbon-Bayes Date: Tue, 1 Dec 2015 17:13:11 +0100 Subject: [PATCH 2/2] fix password config value handling --- lib/logstash/inputs/twitter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/logstash/inputs/twitter.rb b/lib/logstash/inputs/twitter.rb index 23aa2f1..de7affc 100644 --- a/lib/logstash/inputs/twitter.rb +++ b/lib/logstash/inputs/twitter.rb @@ -216,8 +216,8 @@ def configure(c) proxy_address: @proxy_address, proxy_port: @proxy_port } - c.proxy[:proxy_username] = @proxy_username if @proxy_username - c.proxy[:proxy_password] = @proxy_password if @proxy_password + c.proxy[:proxy_username] = @proxy_username if @proxy_username + c.proxy[:proxy_password] = @proxy_password.value if @proxy_password end end