forked from External/greenlight
fix callback tests
This commit is contained in:
parent
206f293194
commit
688120045b
|
@ -270,6 +270,7 @@ class BbbController < ApplicationController
|
||||||
def validate_checksum
|
def validate_checksum
|
||||||
secret = ENV['BIGBLUEBUTTON_SECRET']
|
secret = ENV['BIGBLUEBUTTON_SECRET']
|
||||||
checksum = params["checksum"]
|
checksum = params["checksum"]
|
||||||
|
return false unless checksum
|
||||||
|
|
||||||
# Decode and break the body into parts.
|
# Decode and break the body into parts.
|
||||||
parts = URI.decode_www_form(read_body(request))
|
parts = URI.decode_www_form(read_body(request))
|
||||||
|
@ -279,7 +280,7 @@ class BbbController < ApplicationController
|
||||||
|
|
||||||
# Manually remove the space between the two elements.
|
# Manually remove the space between the two elements.
|
||||||
converted_data[converted_data.rindex("timestamp") - 2] = ''
|
converted_data[converted_data.rindex("timestamp") - 2] = ''
|
||||||
|
|
||||||
callback_url = uri_remove_param(request.original_url, "checksum")
|
callback_url = uri_remove_param(request.original_url, "checksum")
|
||||||
|
|
||||||
checksum_str = "#{callback_url}#{converted_data}#{secret}"
|
checksum_str = "#{callback_url}#{converted_data}#{secret}"
|
||||||
|
|
|
@ -176,7 +176,7 @@ class BbbControllerTest < ActionController::TestCase
|
||||||
"meeting_id": "f344d42cc5ea2fbb7fe64edabce42dae5dc1c0c5-1487709353538"}},
|
"meeting_id": "f344d42cc5ea2fbb7fe64edabce42dae5dc1c0c5-1487709353538"}},
|
||||||
"timestamp": 1488557092}
|
"timestamp": 1488557092}
|
||||||
|
|
||||||
request.env['RAW_POST_DATA'] = data.to_json
|
request.env['RAW_POST_DATA'] = URI.encode_www_form(data)
|
||||||
Digest::SHA1.hexdigest(
|
Digest::SHA1.hexdigest(
|
||||||
"#{data[:event][:payload][:metadata][:'gl-webhooks-callback-url']}#{data.to_json}#{secret}")
|
"#{data[:event][:payload][:metadata][:'gl-webhooks-callback-url']}#{data.to_json}#{secret}")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue