panda_pal 5.6.0 → 5.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57786e37a6af09156402d16afed167b7984105dde04a1e1cc32aad5d8505567a
4
- data.tar.gz: 1d9cc2abbe1dce34ce0d52aa0234f6f8e909dca3a5c9eabd59b57d2b91de9f90
3
+ metadata.gz: 79e31ac9d48be7e13d818cd57950034fa982726721bb9c451bac65ee3aaee702
4
+ data.tar.gz: 1bf00f07eba7546e160b2ee268e3bbfd37fdd3dfdf339999e8f322c43ceb6780
5
5
  SHA512:
6
- metadata.gz: 1943d3e91f8c510f28eeedd1793a8853545800608b098aa29e217a3ab7a155ad6e6ea414e6c661b13206b0980b527425564612c91f65a97e17537436ac30e449
7
- data.tar.gz: d762fe3b44e97fda8eaded8595ebf4f53a8a2e551de8fd5ab8e74433068dcb2a52fcc0dcbf5af637ca0e28c13ee88d3d751a3860bd8d873d61f85a3199d44055
6
+ metadata.gz: 4dfa6dbf1aff76385844bb204aab7298d4096410df44cc2646643fe28bd2a2d54c9960f932c624544ee990218fc95022e27964c73b7604545fafa6618630fa0b
7
+ data.tar.gz: 0a74434217765714b28247315515ba9c6c71931d367e96130d3ed51a4f334ce43c03d80a0bdb6dfeee27caeff98f36c857cd525e61ee294a36db88f2619e4e76
@@ -2,7 +2,11 @@ require_dependency "panda_pal/application_controller"
2
2
 
3
3
  module PandaPal
4
4
  class LtiV1P0Controller < ApplicationController
5
- skip_before_action :verify_authenticity_token
5
+ if Rails.version < '5.0'
6
+ skip_before_action :verify_authenticity_token
7
+ else
8
+ skip_before_action :verify_authenticity_token, raise: false
9
+ end
6
10
 
7
11
  def launch
8
12
  current_session_data.merge!({
@@ -2,11 +2,23 @@ require_dependency "panda_pal/application_controller"
2
2
 
3
3
  module PandaPal
4
4
  class LtiV1P3Controller < ApplicationController
5
- skip_before_action :verify_authenticity_token
5
+ if Rails.version < '5.0'
6
+ skip_before_action :verify_authenticity_token
7
+ else
8
+ skip_before_action :verify_authenticity_token, raise: false
9
+ end
10
+
6
11
  before_action :validate_launch!, only: [:resource_link_request]
7
12
  around_action :switch_tenant, only: [:resource_link_request]
8
13
 
9
14
  def login
15
+ # TODO Figure out how to make this support deployment_ids
16
+ # May need to move Platform#jwks_url and Platform#authentication_redirect_url to
17
+ # a new GenericPlatform class/model and then associate the here-generated Session with
18
+ # the public tenant, re-homing it once we have a deployment_id available
19
+ # ... or create a new AuthState model instead of using Session here
20
+ @organization = PandaPal::Organization.find_by!(key: params[:client_id])
21
+
10
22
  current_session_data[:lti_oauth_nonce] = SecureRandom.uuid
11
23
 
12
24
  @form_action = current_lti_platform.authentication_redirect_url
@@ -3,6 +3,8 @@ begin
3
3
  rescue LoadError
4
4
  end
5
5
 
6
+ require 'httparty'
7
+
6
8
  module PandaPal
7
9
  class Platform
8
10
  def public_jwks
@@ -49,7 +51,7 @@ module PandaPal
49
51
  "#{base_url}/login/oauth2/token"
50
52
  end
51
53
 
52
- def base_url; org.canvas_url; end
54
+ def base_url; @organization.canvas_url; end # TODO Dissolve?
53
55
 
54
56
  module OrgExtension
55
57
  def install_lti(host: nil, context: :root_account, version: 'v1p1', exists: :error)
@@ -60,7 +60,7 @@ module PandaPal
60
60
  ActionDispatch::Routing::Mapper.send :include, PandaPal::Helpers::RouteHelper
61
61
  end
62
62
 
63
- initializer 'panda_pal.route_options' do |app|
63
+ initializer 'panda_pal.route_options', after: :build_middleware_stack do |app|
64
64
  ActiveSupport.on_load(:action_controller) do
65
65
  Rails.application.reload_routes!
66
66
  PandaPal::validate_pandapal_config!
@@ -59,7 +59,15 @@ module PandaPal::Helpers
59
59
  raise JSON::JWT::VerificationFailed, 'error decoding id_token' if decoded_jwt.blank?
60
60
 
61
61
  client_id = decoded_jwt['aud']
62
- @organization = PandaPal::Organization.find_by!(key: client_id)
62
+ deployment_id = decoded_jwt['https://purl.imsglobal.org/spec/lti/claim/deployment_id']
63
+
64
+ if deployment_id.present?
65
+ @organization ||= PandaPal::Organization.find_by(key: "#{client_id}/#{deployment_id}")
66
+ @organization ||= PandaPal::Organization.find_by(key: deployment_id)
67
+ end
68
+
69
+ @organization ||= PandaPal::Organization.find_by(key: client_id)
70
+
63
71
  raise JSON::JWT::VerificationFailed, 'Unrecognized Organization' unless @organization.present?
64
72
 
65
73
  decoded_jwt.verify!(current_lti_platform.public_jwks)
@@ -124,8 +132,6 @@ module PandaPal::Helpers
124
132
 
125
133
  def organization_key
126
134
  org_key ||= params[:oauth_consumer_key]
127
- org_key ||= "#{params[:client_id]}/#{params[:deployment_id]}" if params[:client_id].present? && params[:deployment_id].present?
128
- org_key ||= params[:client_id] if params[:client_id].present?
129
135
  org_key ||= session[:organization_key]
130
136
  org_key
131
137
  end
@@ -10,10 +10,7 @@ module PandaPal::Helpers::RouteHelper
10
10
 
11
11
  lti_options = options.delete(:lti_options) || {}
12
12
  lti_options[:auto_launch] = options.delete(:auto_launch)
13
-
14
- if lti_options[:auto_launch].nil?
15
- lti_options[:auto_launch] = (@scope[:path] || '').include?(':organization_id')
16
- end
13
+ lti_options[:auto_launch] = true if lti_options[:auto_launch].nil? && (@scope[:path] || '').include?(':organization_id')
17
14
 
18
15
  lti_options[:route_helper_key] = path.split('/').reject(&:empty?).join('_')
19
16
  post(path, options.dup, &block)
@@ -1,3 +1,3 @@
1
1
  module PandaPal
2
- VERSION = "5.6.0"
2
+ VERSION = "5.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure ProServe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails