atomic_lti_1v1 1.0.1 → 1.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: 176fa5e170efd585a02c5b801a1a5eb129c442901fb50afa06d53759d6af3d04
4
- data.tar.gz: 3a5bda879132e3edc8a7610d26ad5ab0ef1501e5037aa8c88cc8d78e5a7611bf
3
+ metadata.gz: 047ac4efd469c0eba37952597927eed31aa9945eabc4f28cbced8b007722abcc
4
+ data.tar.gz: 5a55084206a8eb496f7856ab877b88687ebd63f2394dc1bfea40922e83dc1e8c
5
5
  SHA512:
6
- metadata.gz: 4288e2af09e0f2340604844a8327f1db353b1a19d9cc1262b0801367d5c357eb3152b58467b7467f0ed0c04aaa1b6d3fd94eef71e9e1fd6f4bb6b968e204b21c
7
- data.tar.gz: be0b0f824080ed8c5658dfa8ff9d0ed1226385a8727cf3c8060d1d8765b331257e622bf77eae667fda24a2c2b880f04cf7dc78bfe931778f43b34fa388e1f847
6
+ metadata.gz: b3c8f4e05cd0ae77a356c9c51fce51b2c863d0583b852f3e21d7be854341a250918a3a81cd63a8cc7fec594c4b82fb397d49685e93641bfbb5fe0b5a351c82c6
7
+ data.tar.gz: fc09b37d88910afbd8e6941fed3e31997c9330731a5829de1c4054d493035dc525eb16482a43451bc9c7546042e41890fe0ecc7834688af703a4e9e28da4d25c
data/README.md CHANGED
@@ -42,6 +42,8 @@ Provide `secret_provider`
42
42
  # If using most Atomic Jolt Apps, probably something like this
43
43
  ApplicationInstance.find_by(lti_key: oauth_consumer_key)&.lti_secret
44
44
  end
45
+ # List of path prefixes to handle. Default is the following:
46
+ AtomicLti1v1.path_prefixes = ["/lti_launches"]
45
47
  ```
46
48
 
47
49
  ## License
@@ -1,7 +1,9 @@
1
1
  module AtomicLti1v1
2
2
  class Lti1v1
3
3
  def self.is_lti_1v1?(request)
4
- request.params['oauth_consumer_key'].present?
4
+ request.params['oauth_consumer_key'].present? &&
5
+ request.params['oauth_signature'].present? &&
6
+ request.params['lti_version'] == 'LTI-1p0'
5
7
  end
6
8
 
7
9
  def self.valid_timestamp?(request)
@@ -5,9 +5,15 @@ module AtomicLti1v1
5
5
  @app = app
6
6
  end
7
7
 
8
+ def matches_path_prefixes?(request)
9
+ AtomicLti1v1.path_prefixes.any? do |prefix|
10
+ request.path.starts_with? prefix
11
+ end
12
+ end
13
+
8
14
  def call(env)
9
15
  request = Rack::Request.new(env)
10
- if AtomicLti1v1::Lti1v1.is_lti_1v1?(request)
16
+ if matches_path_prefixes?(request) && AtomicLti1v1::Lti1v1.is_lti_1v1?(request)
11
17
  oauth_consumer_key = request.params['oauth_consumer_key']
12
18
 
13
19
  lti_secret = nil
@@ -1,3 +1,3 @@
1
1
  module AtomicLti1v1
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -4,6 +4,7 @@ require 'atomic_lti_1v1/lti_1v1_middleware'
4
4
 
5
5
  module AtomicLti1v1
6
6
  mattr_accessor :secret_provider
7
+ mattr_accessor :path_prefixes, default: ['/lti_launches']
7
8
 
8
9
  class LtiValidationFailed < StandardError; end
9
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic_lti_1v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Benoit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-02 00:00:00.000000000 Z
11
+ date: 2023-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.1.2
94
+ rubygems_version: 3.4.15
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Rack middleware to handle validating Lti 1.1 requests