32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/logstash/filters/jwt_decoder.rb', line 32
def filter(event)
raw_message = event.get(@access_token_field)
if(raw_message)
if match = raw_message.match(@token_pattern)
token = match.captures[@match_group_index]
decoded_token = JWT.decode token, nil, false
result = Hash.new
@extract.each do |key, value|
jsonPath = JsonPath.new(value)
result[key] = jsonPath.first(decoded_token)
end
event.set(@output_field, result)
filter_matched(event)
end
end
end
|