coalescing_panda 1.1.0 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWZiYzEwOTYzYTc4YmZjMjEyZGEyZjIzNTAxZGUwZTAwYjhmYTRhYw==
5
+ data.tar.gz: !binary |-
6
+ NDU1YTg3MmNlNWE1YjQxZTgwZjliNDc4MmU5ODVlNjEzNTAyNWZjNw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ N2MxNGJlNzI0ODAzMWE3ZGQwYjExYWMyZWY2Mjg2NmRhNjNmY2IwNjg0ODU0
10
+ MTk2YjY0NzdlMmQ3NmEwOWIzOGYwYjY4MTBkNTY2NGIyOWMyOTljZTkzNmQy
11
+ ZWI1MzFhNzdjYjA1YmJmYjJkZTBhZmU2OTA3MTFjNDViNDRmNWQ=
12
+ data.tar.gz: !binary |-
13
+ MGMzMTE4ZDkwOTIzNjAyZjYxYWE5MDZkOTFiOTY0MWFhMzhiMzkzZDM4NDgx
14
+ MTE2NWRlYWE5Yjc1YjdmNjZhY2UxZDE1YTBlMGZmOWNkYTk4OTJjYjM0YjM0
15
+ MjVhMzI1NTYwODUyZmJiMDM4OTJkYjNmNTg2NjlhMTA4YzJiOTE=
@@ -36,6 +36,11 @@ module CoalescingPanda
36
36
  render 'coalescing_panda/launch'
37
37
  end
38
38
 
39
+ def start_session
40
+ session['started'] = true
41
+ redirect_to CGI::unescape(params['referer'])
42
+ end
43
+
39
44
  private
40
45
 
41
46
  def setting_name(name)
@@ -7,7 +7,7 @@ module CoalescingPanda
7
7
  end
8
8
 
9
9
  def redirect
10
- unless params[:error]
10
+ if !params[:error] && valid_state_token
11
11
  lti_account = LtiAccount.find_by_key(params[:key])
12
12
  client_id = lti_account.oauth2_client_id
13
13
  client_key = lti_account.oauth2_client_key
@@ -30,5 +30,9 @@ module CoalescingPanda
30
30
  ENV['OAUTH_PROTOCOL'] || 'https'
31
31
  end
32
32
 
33
+ def valid_state_token
34
+ return false unless params['state'].present? && session['state'].present?
35
+ params['state'] == session['state']
36
+ end
33
37
  end
34
38
  end
data/config/routes.rb CHANGED
@@ -3,4 +3,5 @@ CoalescingPanda::Engine.routes.draw do
3
3
  get '/config' => 'lti#lti_config'
4
4
  get '/launch' => 'lti#launch'
5
5
  get '/styleguide' => 'lti#styleguide'
6
+ get '/start_session' => 'lti#start_session', as: :start_session
6
7
  end
@@ -19,10 +19,10 @@ module CoalescingPanda
19
19
  elsif @lti_account = params['oauth_consumer_key'] && LtiAccount.find_by_key(params['oauth_consumer_key'])
20
20
  client_id = @lti_account.oauth2_client_id
21
21
  client = Bearcat::Client.new(prefix: scheme+api_domain)
22
-
22
+ session['state'] = SecureRandom.hex(32)
23
23
  @canvas_url = client.auth_redirect_url(client_id,
24
24
  coalescing_panda.oauth2_redirect_url({key: params['oauth_consumer_key'],
25
- user_id: user_id, api_domain: api_domain}))
25
+ user_id: user_id, api_domain: api_domain, state: session['state']}))
26
26
  #delete the added params so the original oauth sig still works
27
27
  @lti_params.delete('action')
28
28
  @lti_params.delete('controller')
@@ -32,11 +32,12 @@ module CoalescingPanda
32
32
  end
33
33
 
34
34
  def have_session?
35
- #if this is a new lti launch flush the session
36
- if params['tool_consumer_instance_guid']
35
+ if params['tool_consumer_instance_guid'] && session['user_id'] != params['user_id']
37
36
  reset_session
38
37
  logger.info("resetting session params")
38
+ session['user_id'] = params['user_id']
39
39
  end
40
+
40
41
  if (session['user_id'] && session['uri'])
41
42
  uri = URI.parse(session['uri'])
42
43
  api_domain = uri.host
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.3'
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nathan Mills
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-04-03 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bearcat
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: macaddr
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - '='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - '='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: ims-lti
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: haml-rails
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: sass-rails
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: jquery-rails
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: coffee-rails
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ~>
132
116
  - !ruby/object:Gem::Version
@@ -134,15 +118,27 @@ dependencies:
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ~>
140
123
  - !ruby/object:Gem::Version
141
124
  version: 4.0.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: protected_attributes
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
142
139
  - !ruby/object:Gem::Dependency
143
140
  name: sqlite3
144
141
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
142
  requirements:
147
143
  - - ! '>='
148
144
  - !ruby/object:Gem::Version
@@ -150,7 +146,6 @@ dependencies:
150
146
  type: :development
151
147
  prerelease: false
152
148
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
149
  requirements:
155
150
  - - ! '>='
156
151
  - !ruby/object:Gem::Version
@@ -158,7 +153,6 @@ dependencies:
158
153
  - !ruby/object:Gem::Dependency
159
154
  name: rspec-rails
160
155
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
156
  requirements:
163
157
  - - ! '>='
164
158
  - !ruby/object:Gem::Version
@@ -166,7 +160,6 @@ dependencies:
166
160
  type: :development
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
163
  requirements:
171
164
  - - ! '>='
172
165
  - !ruby/object:Gem::Version
@@ -174,7 +167,6 @@ dependencies:
174
167
  - !ruby/object:Gem::Dependency
175
168
  name: shoulda-matchers
176
169
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
170
  requirements:
179
171
  - - ! '>='
180
172
  - !ruby/object:Gem::Version
@@ -182,7 +174,6 @@ dependencies:
182
174
  type: :development
183
175
  prerelease: false
184
176
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
177
  requirements:
187
178
  - - ! '>='
188
179
  - !ruby/object:Gem::Version
@@ -190,7 +181,6 @@ dependencies:
190
181
  - !ruby/object:Gem::Dependency
191
182
  name: nokogiri
192
183
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
184
  requirements:
195
185
  - - ! '>='
196
186
  - !ruby/object:Gem::Version
@@ -198,7 +188,6 @@ dependencies:
198
188
  type: :development
199
189
  prerelease: false
200
190
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
191
  requirements:
203
192
  - - ! '>='
204
193
  - !ruby/object:Gem::Version
@@ -206,7 +195,6 @@ dependencies:
206
195
  - !ruby/object:Gem::Dependency
207
196
  name: simplecov
208
197
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
198
  requirements:
211
199
  - - ! '>='
212
200
  - !ruby/object:Gem::Version
@@ -214,7 +202,6 @@ dependencies:
214
202
  type: :development
215
203
  prerelease: false
216
204
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
205
  requirements:
219
206
  - - ! '>='
220
207
  - !ruby/object:Gem::Version
@@ -222,7 +209,6 @@ dependencies:
222
209
  - !ruby/object:Gem::Dependency
223
210
  name: debugger
224
211
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
212
  requirements:
227
213
  - - ! '>='
228
214
  - !ruby/object:Gem::Version
@@ -230,7 +216,20 @@ dependencies:
230
216
  type: :development
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: pry
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ! '>='
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
234
233
  requirements:
235
234
  - - ! '>='
236
235
  - !ruby/object:Gem::Version
@@ -242,6 +241,7 @@ executables: []
242
241
  extensions: []
243
242
  extra_rdoc_files: []
244
243
  files:
244
+ - Rakefile
245
245
  - app/assets/images/bootstrap/glyphicons-halflings-white.png
246
246
  - app/assets/images/bootstrap/glyphicons-halflings.png
247
247
  - app/assets/javascripts/bootstrap/bootstrap-datepicker.js
@@ -271,15 +271,16 @@ files:
271
271
  - db/migrate/20131114150001_create_coalescing_panda_canvas_api_auths.rb
272
272
  - db/migrate/20131118211442_create_coalescing_panda_lti_accounts.rb
273
273
  - db/migrate/20131119165343_create_coalescing_panda_lti_nonces.rb
274
+ - lib/coalescing_panda.rb
274
275
  - lib/coalescing_panda/controller_helpers.rb
275
276
  - lib/coalescing_panda/engine.rb
276
277
  - lib/coalescing_panda/route_helpers.rb
277
278
  - lib/coalescing_panda/version.rb
278
- - lib/coalescing_panda.rb
279
279
  - lib/tasks/coalescing_panda_tasks.rake
280
- - Rakefile
281
280
  - spec/controllers/coalescing_panda/lti_controller_spec.rb
282
281
  - spec/controllers/coalescing_panda/oauth2_controller_spec.rb
282
+ - spec/dummy/README.rdoc
283
+ - spec/dummy/Rakefile
283
284
  - spec/dummy/app/assets/javascripts/application.js
284
285
  - spec/dummy/app/assets/stylesheets/application.css
285
286
  - spec/dummy/app/controllers/application_controller.rb
@@ -288,6 +289,7 @@ files:
288
289
  - spec/dummy/bin/bundle
289
290
  - spec/dummy/bin/rails
290
291
  - spec/dummy/bin/rake
292
+ - spec/dummy/config.ru
291
293
  - spec/dummy/config/application.rb
292
294
  - spec/dummy/config/boot.rb
293
295
  - spec/dummy/config/database.yml
@@ -305,39 +307,35 @@ files:
305
307
  - spec/dummy/config/initializers/wrap_parameters.rb
306
308
  - spec/dummy/config/locales/en.yml
307
309
  - spec/dummy/config/routes.rb
308
- - spec/dummy/config.ru
309
310
  - spec/dummy/db/schema.rb
310
311
  - spec/dummy/public/404.html
311
312
  - spec/dummy/public/422.html
312
313
  - spec/dummy/public/500.html
313
314
  - spec/dummy/public/favicon.ico
314
- - spec/dummy/Rakefile
315
- - spec/dummy/README.rdoc
316
315
  - spec/models/coalescing_panda/canvas_api_auth_spec.rb
317
316
  - spec/spec_helper.rb
318
317
  homepage: http://www.instructure.com
319
318
  licenses: []
319
+ metadata: {}
320
320
  post_install_message:
321
321
  rdoc_options: []
322
322
  require_paths:
323
323
  - lib
324
324
  required_ruby_version: !ruby/object:Gem::Requirement
325
- none: false
326
325
  requirements:
327
326
  - - ! '>='
328
327
  - !ruby/object:Gem::Version
329
328
  version: '0'
330
329
  required_rubygems_version: !ruby/object:Gem::Requirement
331
- none: false
332
330
  requirements:
333
331
  - - ! '>='
334
332
  - !ruby/object:Gem::Version
335
333
  version: '0'
336
334
  requirements: []
337
335
  rubyforge_project:
338
- rubygems_version: 1.8.23
336
+ rubygems_version: 2.2.2
339
337
  signing_key:
340
- specification_version: 3
338
+ specification_version: 4
341
339
  summary: Canvas LTI and OAUTH2 mountable engine
342
340
  test_files:
343
341
  - spec/controllers/coalescing_panda/lti_controller_spec.rb