diff --git a/app/controllers/concerns/open_id_authenticator.rb b/app/controllers/concerns/open_id_authenticator.rb index e3913066..349898f1 100644 --- a/app/controllers/concerns/open_id_authenticator.rb +++ b/app/controllers/concerns/open_id_authenticator.rb @@ -29,6 +29,9 @@ def verify_openid_launch jwt_header = JSON.parse(Base64.urlsafe_decode64(jwt_parts[0])) jwt_body = JSON.parse(Base64.urlsafe_decode64(jwt_parts[1])) + logger.debug("jwt.header:\n#{jwt_header.inspect}") + logger.debug("jwt.body:\n#{jwt_body.inspect}") + validate_nonce(jwt_body) # validate registration (deployment) diff --git a/lib/bbb_lti_broker/helpers.rb b/lib/bbb_lti_broker/helpers.rb index 9d48724d..d1570fe9 100644 --- a/lib/bbb_lti_broker/helpers.rb +++ b/lib/bbb_lti_broker/helpers.rb @@ -60,7 +60,6 @@ def secure_url(url) # def standarized_message(message_json) message = JSON.parse(message_json) - # Consider for conversion all 1.3 launches, which even though , b) launches that did not come in common format if message['user_id'].blank? migration_map.each do |param, claim| @@ -72,14 +71,10 @@ def standarized_message(message_json) end custom_params = message['unknown_params']['https://purl.imsglobal.org/spec/lti/claim/custom'] || {} - custom_params.each do |key, value| - message["custom_#{key}"] = value - end + message['custom_params'] = custom_params ext_params = message['unknown_params']['https://purl.imsglobal.org/spec/lti/claim/ext'] || {} - ext_params.each do |key, value| - message["ext_#{key}"] = value - end + message['ext_params'] = ext_params end curated_message = custom_overrides(message) @@ -114,15 +109,16 @@ def user_params(tc_instance_guid, params) # custom_override_resource_link_id="another value" -> resource_link_id= # def custom_overrides(message) - message.each do |custom_param_name, value| + custom_params = message['custom_params'].to_h + custom_params.each do |custom_param_name, value| next unless custom_param_name.start_with?('custom_override_') param_name = custom_param_name.delete_prefix('custom_override_') next unless safe_custom_override_params.include?(param_name) pattern = value.split(':') - message[param_name] = pattern[1] if pattern[0] == 'static' && next - message[param_name] = message[pattern[1]] if pattern[0] == 'param' + message[param_name] = pattern[1] if pattern[0] == 'static' + message[param_name] = message['custom_params'][pattern[1]] if pattern[0] == 'param' end message end