Skip to content

Commit

Permalink
Revert "LTI-382: normalise custom and ext parameters across messages (#…
Browse files Browse the repository at this point in the history
…250)" (#251)

This reverts commit 0e66da5.
  • Loading branch information
jfederico authored Jun 19, 2024
1 parent 0e66da5 commit b9efa0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 3 additions & 0 deletions app/controllers/concerns/open_id_authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 6 additions & 10 deletions lib/bbb_lti_broker/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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)
Expand Down Expand Up @@ -114,15 +109,16 @@ def user_params(tc_instance_guid, params)
# custom_override_resource_link_id="another value" -> resource_link_id=<no overriding is made>
#
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
Expand Down

0 comments on commit b9efa0e

Please sign in to comment.