Skip to content

Commit

Permalink
Revert "Revert "Setup local reproduction""
Browse files Browse the repository at this point in the history
This reverts commit a09090a.
  • Loading branch information
jorg-vr committed Nov 9, 2023
1 parent a09090a commit 6b80235
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
33 changes: 32 additions & 1 deletion app/controllers/concerns/set_lti_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,38 @@ module SetLtiMessage
include LTI::Messages

def set_lti_message
@lti_message = parse_message(params[:id_token], params[:provider_id])
# @lti_message = parse_message(params[:id_token], params[:provider_id])
provider = Provider::Lti.find(params[:provider_id])
payload = {
iss: provider.issuer,
aud: provider.client_id,
exp: Time.now.to_i + 600,
iat: Time.now.to_i,
sub: 'test-user-123',
nonce: 'nonce',
'https://purl.imsglobal.org/spec/lti/claim/message_type': 'target',
'https://purl.imsglobal.org/spec/lti/claim/version': '1.3.0',
'https://purl.imsglobal.org/spec/lti/claim/deployment_id': 'c5899818-7062-44d1-b377-5a08097daeb3',
'https://purl.imsglobal.org/spec/lti/claim/target_link_uri': 'LtiDeepLinkingRequest',
'https://purl.imsglobal.org/spec/lti/claim/resource_link': {
id: '5B0748E6-E75C-4A93-8875-E034639B31CD-513799_107172',
title: 'Oef 3-2 - vierkantsvergelijking',
description: nil
},
'https://purl.imsglobal.org/spec/lti-dl/claim/deep_linking_settings': {
accept_types: %w[link file html ltiResourceLink image],
accept_media_types: 'image/*,text/html',
accept_presentation_document_targets: %w[iframe window embed],
accept_multiple: true,
auto_create: true,
title: 'This is the default title',
text: 'This is the default text',
data: 'Some random opaque data that MUST be sent back',
deep_link_return_url: 'https://www.example.com/deep_links'
}
}.with_indifferent_access
@lti_message = ::LTI::Messages::Types::DeepLinkingRequest.new(payload)

@lti_launch = @lti_message.is_a?(LTI::Messages::Types::ResourceLaunchRequest)
helpers.locale = @lti_message&.launch_presentation_locale if @lti_message&.launch_presentation_locale.present?
rescue JSON::JWK::Set::KidNotFound => _e
Expand Down
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ default: &default

development:
<<: *default
database: dodona
database: dodona_backup

staging:
<<: *default
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
t.integer "series_id_non_nil", null: false
t.index ["accepted", "user_id", "series_id"], name: "index_activity_statuses_on_accepted_and_user_id_and_series_id"
t.index ["activity_id"], name: "index_activity_statuses_on_activity_id"
t.index ["series_id", "started", "user_id", "last_submission_id"], name: "index_as_on_series_and_started_and_user_and_last_submission"
t.index ["series_id"], name: "fk_rails_1bc42c2178"
t.index ["started", "user_id", "last_submission_id"], name: "index_as_on_started_and_user_and_last_submission"
t.index ["started", "user_id", "series_id"], name: "index_activity_statuses_on_started_and_user_id_and_series_id"
t.index ["user_id", "series_id", "last_submission_id"], name: "index_as_on_user_and_series_and_last_submission"
t.index ["user_id", "series_id_non_nil", "activity_id"], name: "index_on_user_id_series_id_non_nil_activity_id", unique: true
Expand Down

0 comments on commit 6b80235

Please sign in to comment.