rack-lti 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/lti/middleware.rb +2 -2
- data/lib/rack/lti/version.rb +1 -1
- data/test/middleware_test.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb5033988f314beec36f2ec28a42b36e90771687
|
4
|
+
data.tar.gz: 99c197e05ab5d504c5162b298b52851b953344a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c6d14c8b63847b9f10844ecb371f9518e786e39a7079638c4fd120639bcde24d66dcd30eef5e7de03e1088edc4d1bace15229e3aeaf9e0d175fb86943dff73b
|
7
|
+
data.tar.gz: 5c136b52efd1d4301c0cfd038e348e32d10af591db4d5479017c31cf0f41fd0fcee826ec2c7b3be441b192ac16914c0cd66710bceb1ed0016a4461738e2c2c43
|
data/lib/rack/lti/middleware.rb
CHANGED
@@ -61,8 +61,8 @@ module Rack::LTI
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def valid_nonce?(nonce)
|
64
|
-
if @config
|
65
|
-
@config.nonce_validator
|
64
|
+
if @config[:nonce_validator].respond_to?(:call)
|
65
|
+
@config.nonce_validator(nonce)
|
66
66
|
else
|
67
67
|
@config.nonce_validator
|
68
68
|
end
|
data/lib/rack/lti/version.rb
CHANGED
data/test/middleware_test.rb
CHANGED
@@ -57,8 +57,19 @@ class MiddlewareTest < Minitest::Unit::TestCase
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
def test_call_passes_the_nonce_to_the_given_proc
|
61
|
+
assertion = MiniTest::Mock.new
|
62
|
+
assertion.expect(:call, true)
|
63
|
+
@lti_app.config.nonce_validator = ->(nonce) { assertion.call }
|
64
|
+
|
65
|
+
@lti_app.stub(:valid_request?, true) do
|
66
|
+
@lti_app.call(Rack::MockRequest.env_for('/lti/launch'))
|
67
|
+
assertion.verify
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
60
71
|
def test_call_returns_403_on_invalid_nonce
|
61
|
-
@lti_app.config.nonce_validator ->(nonce) { false }
|
72
|
+
@lti_app.config.nonce_validator = ->(nonce) { false }
|
62
73
|
|
63
74
|
@lti_app.stub(:valid_request?, true) do
|
64
75
|
response = @lti_app.call(Rack::MockRequest.env_for('/lti/launch'))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-lti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Pendleton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|