panda_pal 5.6.1 → 5.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/panda_pal/lti_v1_p0_controller.rb +5 -1
- data/app/controllers/panda_pal/lti_v1_p3_controller.rb +13 -1
- data/app/models/panda_pal/platform.rb +3 -1
- data/lib/panda_pal/engine.rb +1 -1
- data/lib/panda_pal/helpers/controller_helper.rb +9 -3
- data/lib/panda_pal/helpers/route_helper.rb +1 -4
- data/lib/panda_pal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a4824355877c5a36c29faacc0da32347ae94be1c52d3efce5aed163bd8ee8d7
|
4
|
+
data.tar.gz: 1742b3a3547d60758eb53f74ffab79b316061c4887073351924229a638da3399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9de12a4da426d281acc78dfb1588a7d2d33bce69d8de4c20d03eff3f12fcf8c4c0bf5aa6cd3e1951f1f061ea67a0e6a280b2c925dcc0619e27244858975e14ac
|
7
|
+
data.tar.gz: 8ccf4609b82b88456ecf5f245bca29e98aa916179c35da74a33a0eee57a4713f0dd9522e011999928df0267ce938d4a8f1f308a616b83da237c8d2f82bf691e0
|
@@ -2,7 +2,11 @@ require_dependency "panda_pal/application_controller"
|
|
2
2
|
|
3
3
|
module PandaPal
|
4
4
|
class LtiV1P0Controller < ApplicationController
|
5
|
-
|
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
|
-
|
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;
|
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)
|
data/lib/panda_pal/engine.rb
CHANGED
@@ -60,7 +60,7 @@ module PandaPal
|
|
60
60
|
ActionDispatch::Routing::Mapper.send :include, PandaPal::Helpers::RouteHelper
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
config.after_initialize 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
|
-
|
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)
|
data/lib/panda_pal/version.rb
CHANGED
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.
|
4
|
+
version: 5.6.4
|
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-
|
11
|
+
date: 2022-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|