class LogStash::Filters::JwtDecoder

Public Instance Methods

filter(event) click to toggle source
# File lib/logstash/filters/jwt_decoder.rb, line 32
def filter(event)
    # Replace the event message with our message as configured in the
    # config file.
    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
register() click to toggle source
# File lib/logstash/filters/jwt_decoder.rb, line 27
def register
  # Add instance variables
end