atomic_lti 1.2.0 → 1.3.1

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: 7381dbf24886137688f92e773144dd5194746ad605b426d743221a7ba2ec25ba
4
- data.tar.gz: ebc4d85849a13db6df43c0b6d906af6fe32b453fbbf3cf34934ff647a64d68c8
3
+ metadata.gz: f4e630de3811dceac9fa0db319f298f3d0f2c2511624466df133e398ab87ad4a
4
+ data.tar.gz: afa911b83546448c4a14e0ce27f8e4fb773e4b44c261362fe4e777f49a5fa023
5
5
  SHA512:
6
- metadata.gz: 129f9b79ae60f4bb7a00db8199c83ee0348a6d2484280f895736e89e9d26cf3531fe9b557072cd07011234675ce658a8dfe6e1227e81442c2cdbcb2dccd4e685
7
- data.tar.gz: 955d5ff4465790e5106d9b551fdcd8b52b8a93cd41c919b16ac1d2c6b31cfd97f2637b8bd64aa5b26cd702e54c90ecb578749c9bc6ce8486057cb163d5978027
6
+ metadata.gz: 4a6dd4c17f5b458c2c4adaa8cfd152ad047c906f09d5d6746b05fe13b5efd0f31841a2237e3d65ac9325a74dd26811768c6fabddc536c27e22a4394ce0e19a95
7
+ data.tar.gz: 1f64fb3ed49714598867763504f9609c9769cc34b2e292da18bc5f34bdc97ea081443b836034b56ed1f7054749991999d51ba9e04880171bf79c3d11c9f14253
@@ -16,7 +16,7 @@ module AtomicLti
16
16
 
17
17
  platform = Platform.find_by(iss: iss)
18
18
 
19
- raise AtomicLti::Exceptions::NoLTIPlatform(iss: iss, deployment_id: decoded_token.dig(0, "deployment_id")) if platform.nil?
19
+ raise AtomicLti::Exceptions::NoLTIPlatform.new(iss: iss, deployment_id: decoded_token.dig(0, "deployment_id")) if platform.nil?
20
20
 
21
21
  cache_key = "#{iss}_jwks"
22
22
 
@@ -16,6 +16,19 @@ module AtomicLti
16
16
  errors.push("LTI token is missing required field sub")
17
17
  end
18
18
 
19
+ if decoded_token["aud"].blank?
20
+ errors.push("LTI token is missing required field aud")
21
+ end
22
+
23
+ if decoded_token["aud"].is_a?(Array) && decoded_token["aud"].length > 1
24
+ # OpenID Connect spec specifies the AZP should exist and be an AUD
25
+ if decoded_token["azp"].blank?
26
+ errors.push("LTI token has multiple aud and is missing required field azp")
27
+ elsif decoded_token["aud"].exclude?(decoded_token["azp"])
28
+ errors.push("LTI token azp is not one of the aud's")
29
+ end
30
+ end
31
+
19
32
  if decoded_token[AtomicLti::Definitions::DEPLOYMENT_ID].blank?
20
33
  errors.push(
21
34
  "LTI token is missing required field #{AtomicLti::Definitions::DEPLOYMENT_ID}"
@@ -90,5 +103,17 @@ module AtomicLti
90
103
  false
91
104
  end
92
105
  end
106
+
107
+ def self.client_id(decoded_token)
108
+ if decoded_token["aud"]&.is_a?(Array)
109
+ if decoded_token["aud"].length > 1
110
+ decoded_token["azp"]
111
+ else
112
+ decoded_token["aud"][0]
113
+ end
114
+ else
115
+ decoded_token["aud"]
116
+ end
117
+ end
93
118
  end
94
- end
119
+ end
@@ -27,7 +27,7 @@ module AtomicLti
27
27
  tag: tag,
28
28
  startDateTime: start_date_time,
29
29
  endDateTime: end_date_time,
30
- }
30
+ }.compact
31
31
  attrs["resourceLinkId"] = resource_link_id if resource_link_id
32
32
  if external_tool_url
33
33
  attrs[AtomicLti::Definitions::CANVAS_SUBMISSION_TYPE] = {
@@ -159,7 +159,7 @@ module AtomicLti
159
159
  end
160
160
 
161
161
  def update_install(id_token:)
162
- client_id = id_token["aud"]
162
+ client_id = AtomicLti::Lti.client_id(id_token)
163
163
  iss = id_token["iss"]
164
164
 
165
165
  if client_id.present? && iss.present?
@@ -202,7 +202,7 @@ module AtomicLti
202
202
  end
203
203
 
204
204
  def update_deployment(id_token:)
205
- client_id = id_token["aud"]
205
+ client_id = AtomicLti::Lti.client_id(id_token)
206
206
  iss = id_token["iss"]
207
207
  deployment_id = id_token[AtomicLti::Definitions::DEPLOYMENT_ID]
208
208
  platform_guid = id_token.dig(AtomicLti::Definitions::TOOL_PLATFORM_CLAIM, "guid")
@@ -247,7 +247,7 @@ module AtomicLti
247
247
  def build_oidc_response(request, state, nonce, redirect_uri)
248
248
  platform = AtomicLti::Platform.find_by(iss: request.params["iss"])
249
249
  if !platform
250
- raise AtomicLti::Exceptions::NoLTIPlatform(iss: request.params["iss"])
250
+ raise AtomicLti::Exceptions::NoLTIPlatform.new(iss: request.params["iss"])
251
251
  end
252
252
 
253
253
  uri = URI.parse(platform.oidc_url)
@@ -1,3 +1,3 @@
1
1
  module AtomicLti
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic_lti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Petro
@@ -10,36 +10,36 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-03-21 00:00:00.000000000 Z
13
+ date: 2023-03-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rails
16
+ name: pg
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 7.0.3
21
+ version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 7.0.3
28
+ version: '1.3'
29
29
  - !ruby/object:Gem::Dependency
30
- name: pg
30
+ name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '='
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 1.3.5
35
+ version: '7.0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '='
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 1.3.5
42
+ version: '7.0'
43
43
  description: AtomicLti implements the LTI Advantage specification. This gem does contain
44
44
  source code specific to other Atomic Jolt products
45
45
  email: