omniauth-lti 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +17 -6
- data/lib/omniauth-lti/version.rb +1 -1
- data/lib/omniauth/strategies/lti.rb +2 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -5,6 +5,17 @@ The OmniAuth LTI gem provides a way for applications to authenticate users using
|
|
5
5
|
|
6
6
|
It relies on [ims-lti gem][] for validating LTI data.
|
7
7
|
|
8
|
+
Installation
|
9
|
+
============
|
10
|
+
|
11
|
+
Add the gem in your Gemfile:
|
12
|
+
|
13
|
+
gem 'omniauth-lti'
|
14
|
+
|
15
|
+
And install it using bundle
|
16
|
+
|
17
|
+
bundle install
|
18
|
+
|
8
19
|
Usage
|
9
20
|
=====
|
10
21
|
|
@@ -14,7 +25,7 @@ Add the provider to your OmniAuth stack, giving the tool_consumer credentials:
|
|
14
25
|
provider :lti, :oauth_credentials => {:test => 'secret'}
|
15
26
|
end
|
16
27
|
|
17
|
-
Include Omniauth::Lti::Context in your application_controller
|
28
|
+
Include `Omniauth::Lti::Context` in your `application_controller`:
|
18
29
|
|
19
30
|
class ApplicationController < ActionController::Base
|
20
31
|
...
|
@@ -22,19 +33,19 @@ Include Omniauth::Lti::Context in your application_controller:
|
|
22
33
|
...
|
23
34
|
end
|
24
35
|
|
25
|
-
When you create the session in your sessions\_controller
|
36
|
+
When you create the session in your `sessions\_controller`, call to `save_lti_context` for saving LTI context through all the application
|
26
37
|
|
27
|
-
For accessing the context anywhere in your application, just call the helper method
|
38
|
+
For accessing the context anywhere in your application, just call the helper method `lti_tool_provider`.
|
28
39
|
For instance, to show the title of the resource that call your application just put in your haml view:
|
29
40
|
|
30
41
|
=lti_tool_provider.resource_link_title
|
31
42
|
|
32
43
|
You can find an example web application in [omniauth-lti-example-webapp][]
|
33
44
|
|
34
|
-
|
35
|
-
|
45
|
+
Outcomes
|
46
|
+
========
|
36
47
|
|
37
|
-
|
48
|
+
`lti_tool_provider` gives you the full `IMS::LTI::ToolProvider` class. Please refer to (https://github.com/instructure/ims-lti#returning-results-of-a-quizassignment) to see how to do outcomes with this class
|
38
49
|
|
39
50
|
[ims-lti gem]: https://github.com/instructure/ims-lti
|
40
51
|
[omniauth-lti-example-webapp]: https://github.com/xaviaracil/omniauth-lti-example
|
data/lib/omniauth-lti/version.rb
CHANGED
@@ -50,7 +50,9 @@ module OmniAuth
|
|
50
50
|
|
51
51
|
def valid_lti?
|
52
52
|
key = request.params['oauth_consumer_key']
|
53
|
+
log :info, "Checking LTI params for key #{key}: #{request.params}"
|
53
54
|
@tp = IMS::LTI::ToolProvider.new(key, options.oauth_credentials[key], request.params)
|
55
|
+
log :info, "Valid request? #{@tp.valid_request!(request)}"
|
54
56
|
@tp.valid_request!(request)
|
55
57
|
end
|
56
58
|
end
|