coalescing_panda 4.1.11 → 4.1.12
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e582faf4e257cd6f9b0360bf944d9ecc409d68bd
|
4
|
+
data.tar.gz: fa0eb65cccf9239f4456de300538e42e45969510
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3a9b034241743508c58b7893d361bbdadae0b14e26a3c0c415b572d3a420368918bac2a318c9ce4e799d97b64e94dfb1a51b13d7d6e77da93ed061c3f98766f
|
7
|
+
data.tar.gz: bbfbd4409297b27e2fbba9224304dc234f78bca7152c04daa143f91d5f8944f66f521f0cd0bed52f9ff3c7245fa697fb452a7166260b2c4ca886870c421bb5c5
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CoalescingPanda::BearcatUri
|
2
|
+
attr_accessor :uri
|
3
|
+
|
4
|
+
def initialize(uri)
|
5
|
+
Rails.logger.info "Parsing Bearcat URI: #{uri}"
|
6
|
+
@uri = URI.parse(uri)
|
7
|
+
end
|
8
|
+
|
9
|
+
def api_domain
|
10
|
+
uri.port.present? ? "#{uri.host}:#{uri.port.to_s}" : uri.host
|
11
|
+
end
|
12
|
+
|
13
|
+
def scheme
|
14
|
+
[uri.scheme, '://'].join
|
15
|
+
end
|
16
|
+
|
17
|
+
def prefix
|
18
|
+
[scheme, api_domain].join
|
19
|
+
end
|
20
|
+
end
|
@@ -7,7 +7,7 @@ module CoalescingPanda
|
|
7
7
|
if lti_authorize!(*roles)
|
8
8
|
user_id = params['user_id']
|
9
9
|
launch_presentation_return_url = @lti_account.settings[:launch_presentation_return_url] || params['launch_presentation_return_url']
|
10
|
-
uri =
|
10
|
+
uri = BearcatUri.new(launch_presentation_return_url)
|
11
11
|
@lti_params = params.to_hash
|
12
12
|
session['user_id'] = user_id
|
13
13
|
session['uri'] = launch_presentation_return_url
|
@@ -21,9 +21,9 @@ module CoalescingPanda
|
|
21
21
|
client_id = @lti_account.oauth2_client_id
|
22
22
|
client = Bearcat::Client.new(prefix: uri.prefix)
|
23
23
|
session['state'] = SecureRandom.hex(32)
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
redirect_url = [coalescing_panda_url, coalescing_panda.oauth2_redirect_path({key: params['oauth_consumer_key'], user_id: user_id, api_domain: uri.api_domain, state: session['state']})].join
|
25
|
+
@canvas_url = client.auth_redirect_url(client_id, redirect_url)
|
26
|
+
|
27
27
|
#delete the added params so the original oauth sig still works
|
28
28
|
@lti_params.delete('action')
|
29
29
|
@lti_params.delete('controller')
|
@@ -40,7 +40,7 @@ module CoalescingPanda
|
|
40
40
|
end
|
41
41
|
|
42
42
|
if (session['user_id'] && session['uri'])
|
43
|
-
uri =
|
43
|
+
uri = BearcatUri.new(session['uri'])
|
44
44
|
token = CanvasApiAuth.where('user_id = ? and api_domain = ?', session['user_id'], uri.api_domain).pluck(:api_token).first
|
45
45
|
@client = Bearcat::Client.new(token: token, prefix: uri.prefix) if token
|
46
46
|
end
|
@@ -122,26 +122,5 @@ module CoalescingPanda
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
class BearcatURI
|
126
|
-
attr_accessor :uri
|
127
|
-
|
128
|
-
def initialize(uri)
|
129
|
-
Rails.logger.info "Parsing Bearcat URI: #{uri}"
|
130
|
-
@uri = URI.parse(uri)
|
131
|
-
end
|
132
|
-
|
133
|
-
def api_domain
|
134
|
-
uri.port.present? ? "#{uri.host}:#{uri.port.to_s}" : uri.host
|
135
|
-
end
|
136
|
-
|
137
|
-
def scheme
|
138
|
-
[uri.scheme, '://'].join
|
139
|
-
end
|
140
|
-
|
141
|
-
def prefix
|
142
|
-
[scheme, api_domain].join
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
125
|
end
|
147
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coalescing_panda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Mills
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-06-
|
13
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -379,6 +379,7 @@ files:
|
|
379
379
|
- db/migrate/20150526144713_add_account_to_canvas_batches.rb
|
380
380
|
- db/migrate/20150602205257_add_option_to_canvas_batches.rb
|
381
381
|
- lib/coalescing_panda.rb
|
382
|
+
- lib/coalescing_panda/bearcat_uri.rb
|
382
383
|
- lib/coalescing_panda/controller_helpers.rb
|
383
384
|
- lib/coalescing_panda/engine.rb
|
384
385
|
- lib/coalescing_panda/route_helpers.rb
|