lib/rack/twilio_webhook_authentication.rb in twilio-ruby-4.13.0 vs lib/rack/twilio_webhook_authentication.rb in twilio-ruby-5.0.0.alpha1

- old
+ new

@@ -23,25 +23,24 @@ define_singleton_method(:get_auth_token, auth_token_lookup) if block_given? @path_regex = Regexp.union(paths) end def call(env) - return @app.call(env) unless env["PATH_INFO"].match(@path_regex) + return @app.call(env) unless env['PATH_INFO'].match(@path_regex) request = Rack::Request.new(env) original_url = request.url params = request.post? ? request.POST : {} auth_token = @auth_token || get_auth_token(params['AccountSid']) - validator = Twilio::Util::RequestValidator.new(auth_token) - signature = env['HTTP_X_TWILIO_SIGNATURE'] || "" + validator = Twilio::Security::RequestValidator.new(auth_token) + signature = env['HTTP_X_TWILIO_SIGNATURE'] || '' if validator.validate(original_url, params, signature) @app.call(env) else [ 403, - {'Content-Type' => 'text/plain'}, - ["Twilio Request Validation Failed."] + { 'Content-Type' => 'text/plain' }, + ['Twilio Request Validation Failed.'] ] end end end - end