logstash-mixin-http_client 5.0.0 → 5.1.0
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +7 -0
- data/lib/logstash/plugin_mixins/http_client.rb +19 -0
- data/logstash-mixin-http_client.gemspec +1 -1
- data/spec/plugin_mixin/http_client_spec.rb +36 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: accbc8d73a9e83d972f9e0a8fb4e559af7190943
|
4
|
+
data.tar.gz: 81084e1fa78f82fcd72572bdb0c94f03a3ee3e36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1be836f270f3e1023645a22f5f6bbcd7c3c854c440492315a0ae5501087e41dc6b4b0a37c37f040fff1b7beddbad353b0931da81e1d23530e2654c577aaac6d
|
7
|
+
data.tar.gz: d64fb9c5ab678cb1411584ad0382a2277b94a28883114f251f20752f0ad37500b79444670b663b99eb5975795145ce2962c8f4c11b65c4e159868e7928b6770d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -64,6 +64,13 @@ config :proxy
|
|
64
64
|
config :client_cert, :validate => :path
|
65
65
|
# If you'd like to use a client certificate (note, most people don't want this) set the path to the x509 key here
|
66
66
|
config :client_key, :validate => :path
|
67
|
+
|
68
|
+
# If you'd like to use authentication. Options available include:
|
69
|
+
#
|
70
|
+
# user - username to be used
|
71
|
+
# password - password to be used
|
72
|
+
# eager - eagerly offer the Authorization header before the server challenges for it
|
73
|
+
config :auth
|
67
74
|
```
|
68
75
|
|
69
76
|
## Documentation
|
@@ -92,6 +92,12 @@ module LogStash::PluginMixins::HttpClient
|
|
92
92
|
# 2. Proxy host in form: `{host => "proxy.org", port => 80, scheme => 'http', user => 'username@host', password => 'password'}`
|
93
93
|
# 3. Proxy host in form: `{url => 'http://proxy.org:1234', user => 'username@host', password => 'password'}`
|
94
94
|
config :proxy
|
95
|
+
|
96
|
+
# Username to use for HTTP auth.
|
97
|
+
config :user, :validate => :string
|
98
|
+
|
99
|
+
# Password to use for HTTP auth
|
100
|
+
config :password, :validate => :password
|
95
101
|
end
|
96
102
|
|
97
103
|
public
|
@@ -117,6 +123,19 @@ module LogStash::PluginMixins::HttpClient
|
|
117
123
|
@proxy
|
118
124
|
end
|
119
125
|
|
126
|
+
if @user
|
127
|
+
if !@password || !@password.value
|
128
|
+
raise ::LogStash::ConfigurationError, "User '#{@user}' specified without password!"
|
129
|
+
end
|
130
|
+
|
131
|
+
# Symbolize keys if necessary
|
132
|
+
c[:auth] = {
|
133
|
+
:user => @user,
|
134
|
+
:password => @password.value,
|
135
|
+
:eager => true
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
120
139
|
c[:ssl] = {}
|
121
140
|
if @cacert
|
122
141
|
c[:ssl][:ca_file] = @cacert
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-mixin-http_client'
|
3
|
-
s.version = '5.
|
3
|
+
s.version = '5.1.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "AWS mixins to provide a unified interface for Amazon Webservice"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -85,6 +85,42 @@ describe LogStash::PluginMixins::HttpClient do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
describe "http auth" do
|
89
|
+
subject { Dummy.new(client_config).send(:client_config)[:auth] }
|
90
|
+
|
91
|
+
let(:user) { "myuser" }
|
92
|
+
let(:password) { "mypassword" }
|
93
|
+
let(:client_config) { basic_config.merge("user" => user, "password" => password )}
|
94
|
+
|
95
|
+
it "should set the user correctly in the auth settings" do
|
96
|
+
expect(subject[:user]).to eq(user)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should set the password correctly in the auth settings" do
|
100
|
+
expect(subject[:password]).to eq(password)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should always enable eager auth" do
|
104
|
+
expect(subject[:eager]).to eq(true)
|
105
|
+
end
|
106
|
+
|
107
|
+
context "with no user or password" do
|
108
|
+
let(:client_config) { basic_config }
|
109
|
+
|
110
|
+
it "should not set the auth parameter" do
|
111
|
+
expect(subject).to be_nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "with a user but no password specified" do
|
116
|
+
let(:client_config) { c = super; c.delete("password"); c }
|
117
|
+
|
118
|
+
it "should raise a configuration error" do
|
119
|
+
expect { subject }.to raise_error(::LogStash::ConfigurationError)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
88
124
|
["keystore", "truststore"].each do |store|
|
89
125
|
describe "with a custom #{store}" do
|
90
126
|
let(:file) { Stud::Temporary.file }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-mixin-http_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|