fix callback tests

This commit is contained in:
Josh 2017-06-13 09:22:30 -04:00
parent 206f293194
commit 688120045b
2 changed files with 3 additions and 2 deletions

View File

@ -270,6 +270,7 @@ class BbbController < ApplicationController
def validate_checksum
secret = ENV['BIGBLUEBUTTON_SECRET']
checksum = params["checksum"]
return false unless checksum
# Decode and break the body into parts.
parts = URI.decode_www_form(read_body(request))
@ -279,7 +280,7 @@ class BbbController < ApplicationController
# Manually remove the space between the two elements.
converted_data[converted_data.rindex("timestamp") - 2] = ''
callback_url = uri_remove_param(request.original_url, "checksum")
checksum_str = "#{callback_url}#{converted_data}#{secret}"

View File

@ -176,7 +176,7 @@ class BbbControllerTest < ActionController::TestCase
"meeting_id": "f344d42cc5ea2fbb7fe64edabce42dae5dc1c0c5-1487709353538"}},
"timestamp": 1488557092}
request.env['RAW_POST_DATA'] = data.to_json
request.env['RAW_POST_DATA'] = URI.encode_www_form(data)
Digest::SHA1.hexdigest(
"#{data[:event][:payload][:metadata][:'gl-webhooks-callback-url']}#{data.to_json}#{secret}")
end