atomic_lti 3.0.0 → 3.1.0

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: 22d9da2c6e276eb25de54cc27a58e8cf1f96c1576846b428b5c889623d932948
4
- data.tar.gz: 9da9287f6c0fb06c820fa535092412741eda150d3560a32a4fa5942d492c1917
3
+ metadata.gz: ef847f728d478dfdae12c2bbc136506fc43535085c4087d57ec0d1644cd59983
4
+ data.tar.gz: cfb0b2fae35abb18634b6b10b3d51ae15ad69db0c63b253c194e0c9990bb5b2f
5
5
  SHA512:
6
- metadata.gz: f8ff8338b6de8808f83682650ec1dbe6c51f5361bade45a1e97007cb02913728c3afd64ae5765a4c11c4c555af4949b8e5bcff37f0ccca8b03368c84311b8190
7
- data.tar.gz: 07daca85c3880312aa13421ad89b0af16785cf0c4b5bf51fcb8d8b7e8770cfacfaea0882a9956a92d5be0b4a48eeb6cdca34c6046310efab9aceb0c2388bcdf4
6
+ metadata.gz: 9b79cc0c6fdef8833537c97b40521397be65fe1e2aeecb9e191072b5fc9972cc1cd71f18928c8ba8a60fd656e77e0417751fa187f04d3c5866cf85b270899ed1
7
+ data.tar.gz: d3fc2e4f164ff90c1bd7dc81238d73391cae7134044fed4e8b384aa6ea5b9a10dd0c2acd7348a47f25dde5d02f7582c342cf8e26cf6b9ad265d3d63d3a3ac070
@@ -2,7 +2,12 @@ module AtomicLti
2
2
  class Context < ApplicationRecord
3
3
  query_constraints :context_id, :deployment_id, :iss
4
4
  belongs_to :platform, primary_key: :iss, foreign_key: :iss
5
- belongs_to :deployment, query_constraints: [:iss, :deployment_id], optional: true
5
+
6
+ if Rails.version.to_f >= 7.2
7
+ belongs_to :deployment, foreign_key: [:iss, :deployment_id], optional: true
8
+ else
9
+ belongs_to :deployment, query_constraints: [:iss, :deployment_id], optional: true
10
+ end
6
11
 
7
12
  validates :context_id, presence: true
8
13
  validates :deployment_id, presence: true
@@ -2,8 +2,14 @@ module AtomicLti
2
2
  class Deployment < ApplicationRecord
3
3
  query_constraints :deployment_id, :iss
4
4
  belongs_to :platform, primary_key: :iss, foreign_key: :iss
5
- belongs_to :install, query_constraints: [:client_id, :iss], optional: true
6
- has_many :contexts, query_constraints: [:deployment_id, :iss]
5
+
6
+ if Rails.version.to_f >= 7.2
7
+ belongs_to :install, foreign_key: [:client_id, :iss], optional: true
8
+ has_many :contexts, foreign_key: [:deployment_id, :iss]
9
+ else
10
+ belongs_to :install, query_constraints: [:client_id, :iss], optional: true
11
+ has_many :contexts, query_constraints: [:deployment_id, :iss]
12
+ end
7
13
 
8
14
  # we won't have platform_guid during dynamic registration
9
15
  # belongs_to :platform_instance, primary_key: :guid, foreign_key: :platform_guid, optional: true
@@ -2,7 +2,12 @@ module AtomicLti
2
2
  class Install < ApplicationRecord
3
3
  query_constraints :client_id, :iss
4
4
  belongs_to :platform, primary_key: :iss, foreign_key: :iss
5
- has_many :deployments, query_constraints: [:client_id, :iss]
5
+
6
+ if Rails.version.to_f >= 7.2
7
+ has_many :deployments, foreign_key: [:client_id, :iss]
8
+ else
9
+ has_many :deployments, query_constraints: [:client_id, :iss]
10
+ end
6
11
 
7
12
  validates :client_id, presence: true
8
13
  validates :iss, presence: true
@@ -1,3 +1,3 @@
1
1
  module AtomicLti
2
- VERSION = "3.0.0".freeze
2
+ VERSION = "3.1.0".freeze
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: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Petro
@@ -30,16 +30,36 @@ dependencies:
30
30
  name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - "~>"
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '7.1'
36
+ - - "<"
37
+ - !ruby/object:Gem::Version
38
+ version: '9.0'
36
39
  type: :runtime
37
40
  prerelease: false
38
41
  version_requirements: !ruby/object:Gem::Requirement
39
42
  requirements:
40
- - - "~>"
43
+ - - ">="
41
44
  - !ruby/object:Gem::Version
42
45
  version: '7.1'
46
+ - - "<"
47
+ - !ruby/object:Gem::Version
48
+ version: '9.0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: ostruct
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
43
63
  description: AtomicLti implements the LTI Advantage specification. This gem does contain
44
64
  source code specific to other Atomic Jolt products
45
65
  email:
@@ -63,7 +83,6 @@ files:
63
83
  - app/helpers/atomic_lti/launch_helper.rb
64
84
  - app/javascript/atomic_lti/init_app.ts
65
85
  - app/jobs/atomic_lti/application_job.rb
66
- - app/lib/atomic_lti/auth_token.rb
67
86
  - app/lib/atomic_lti/authorization.rb
68
87
  - app/lib/atomic_lti/config.rb
69
88
  - app/lib/atomic_lti/deep_linking.rb
@@ -1,35 +0,0 @@
1
- require "jwt"
2
-
3
- module AtomicLti
4
- module AuthToken
5
-
6
- ALGORITHM = "HS512".freeze
7
-
8
- # More information on jwt available at
9
- # http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#rfc.section.4.1.6
10
- def self.issue_token(payload, exp = 24.hours.from_now, secret = nil, aud = nil, header_fields = {})
11
- payload["iat"] = DateTime.now.to_i # issued at claim
12
- payload["exp"] = exp.to_i # Default expiration set to 24 hours.
13
- payload["aud"] = aud || Rails.application.secrets.auth0_client_id
14
- JWT.encode(
15
- payload,
16
- secret || AtomicLti.jwt_secret,
17
- ALGORITHM,
18
- header_fields,
19
- )
20
- end
21
-
22
- def self.valid?(token, secret = nil, algorithm = ALGORITHM)
23
- decode(token, secret, true, algorithm)
24
- end
25
-
26
- def self.decode(token, secret = nil, validate = true, algorithm = ALGORITHM)
27
- JWT.decode(
28
- token,
29
- secret || AtomicLti.jwt_secret,
30
- validate,
31
- { algorithm: algorithm },
32
- )
33
- end
34
- end
35
- end