panda_pal 5.6.2 → 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: a24c53564f5782a10345c204de6908a094821e30dc7e0803ef7233d1ec5c9f1a
4
- data.tar.gz: ac8f6d55d565ba718fbb3359d7ae129f346b891db9f35be0560a077587ae8812
3
+ metadata.gz: 79e31ac9d48be7e13d818cd57950034fa982726721bb9c451bac65ee3aaee702
4
+ data.tar.gz: 1bf00f07eba7546e160b2ee268e3bbfd37fdd3dfdf339999e8f322c43ceb6780
5
5
  SHA512:
6
- metadata.gz: 0b9d02c9710ea8599c3a1e207c39a5f0540ec2669c50555a5da3f84a35a13e8856eeb30157bc837e94fc8e5d858de96c4b575c2a638c99b1dffa83a7376260af
7
- data.tar.gz: 38aca64711cb7659b44c8b196b5813ef9c0d1f189bbc0f36a10cc0a17cee559743d83cd01151c952dbb984d12141febefcb179647167acb57f268a2b608f6c64
6
+ metadata.gz: 4dfa6dbf1aff76385844bb204aab7298d4096410df44cc2646643fe28bd2a2d54c9960f932c624544ee990218fc95022e27964c73b7604545fafa6618630fa0b
7
+ data.tar.gz: 0a74434217765714b28247315515ba9c6c71931d367e96130d3ed51a4f334ce43c03d80a0bdb6dfeee27caeff98f36c857cd525e61ee294a36db88f2619e4e76
@@ -12,6 +12,13 @@ module PandaPal
12
12
  around_action :switch_tenant, only: [:resource_link_request]
13
13
 
14
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
+
15
22
  current_session_data[:lti_oauth_nonce] = SecureRandom.uuid
16
23
 
17
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)
@@ -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.2"
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.2
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-08-31 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