logstash-filter-auth0jwt 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c6ea12e209674b3f207246b8b0e613151705c6e
4
- data.tar.gz: 638d72570f8d0a9d451b65296504ee421553d193
3
+ metadata.gz: 13944d2420bbbf12cde034a9f5f1cf67c40a4a31
4
+ data.tar.gz: e57da54c0362bf6e663b3b77f7f18218f37fcdb3
5
5
  SHA512:
6
- metadata.gz: 0ed10f3470ed3b2c430f49ed5cb0dff3af1ac1acf8f91804ba67899fa4979e9854952b5d54a18f88268d2ca175c73d5c5ce24b08e9ed516f1ecbb77c54eac096
7
- data.tar.gz: b2b8e5f7933c1c7600d44323c061c9fa2976ba0fe3604d3f154051a123244418db33f557295f1038b7c07971102370b8979d4138f03647b33f79da5171783a85
6
+ metadata.gz: 2fa8568c1cd99b6808ecb756c2962574fb463d952e8548f0c25c1c589b48d62ebd08e6cd24043406290c5ccf8bf43be4470a7215b8c3e9e51dda1e68d867670a
7
+ data.tar.gz: f348aeb62befac8ac28c32a0005bf621514724e9d74b92d3f75f2395fcd3825ec386ec570274dfe675682bf318c9258f5c5597409f893290f3f5d851252ffce3
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Logstash Plugin
1
+ # Logstash Auth0 JWT Validator
2
2
 
3
- This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
-
5
- It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
3
+ This filter validates an Auth0 JWT token, and drops an event if validation fails. The JWT is passed in via a JSON property 'jwt'.
6
4
 
7
5
  # Config
8
6
 
@@ -10,6 +8,12 @@ This filter one required configuration parameter - 'domain'. This maps to the va
10
8
 
11
9
  Also available is an optional parameter - 'purge_seconds' - for configuraing the length of time for which the cache is kept.
12
10
 
11
+ # Logstash Plugin
12
+
13
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
14
+
15
+ It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
16
+
13
17
  ## Documentation
14
18
 
15
19
  Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
@@ -26,6 +26,7 @@ class LogStash::Filters::Auth0Jwt < LogStash::Filters::Base
26
26
  # Replace the message with this value.
27
27
  config :domain, :validate => :string, :required => true
28
28
  config :purge_seconds, :validate => :number, :default => 3600
29
+ config :include_user_properties, :validate => :array, :default => []
29
30
 
30
31
  public
31
32
  def register
@@ -52,6 +53,15 @@ class LogStash::Filters::Auth0Jwt < LogStash::Filters::Base
52
53
  request.body = data.to_json
53
54
  response = https.request(request)
54
55
 
56
+ userHash = JSON.parse(response.body)
57
+
58
+ include_user_properties.each { |user_property|
59
+
60
+ if userHash[user_property]
61
+ event.set(user_property, userHash[user_property])
62
+ end
63
+ }
64
+
55
65
  @cache[event['jwt']] = response.code == "200"
56
66
  end
57
67
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-auth0jwt'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = 'Logstash filter plugin for Auth0 JWT validation.'
6
6
  s.description = 'Logstash filter plugin for Auth0 JWT validation.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-auth0jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Price
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-12 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api