Skip to content

Commit

Permalink
LTI-157: added expiration date to RailsLti2Provider::Tool (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico authored Aug 31, 2022
1 parent ba7d73d commit 6519d3e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/rails_lti2_provider/lti_launch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class LtiLaunch < ApplicationRecord
def self.check_launch(lti_message)
tool = Tool.find_by_uuid(lti_message.oauth_consumer_key)
raise Unauthorized, :invalid_key unless tool
raise Unauthorized, :expired_key unless tool.expired_at.nil? || tool.expired_at > Time.now
unless IMS::LTI::Services::MessageAuthenticator
.new(lti_message.launch_url,
lti_message.post_params.merge(lti_message.oauth_params), tool.shared_secret).valid_signature?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddExpirationDateToRailsLti2ProviderTool < ActiveRecord::Migration[6.0]
def change
add_column(:rails_lti2_provider_tools, :expired_at, :datetime)
end
end
2 changes: 1 addition & 1 deletion lib/rails_lti2_provider/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RailsLti2Provider
VERSION = '0.1.2'
VERSION = '0.1.3'
end

0 comments on commit 6519d3e

Please sign in to comment.