coalescing_panda 1.4.1 → 2.0.0

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: 88e2c697341d0aa9f5b272f3a865e8da1540606c
4
- data.tar.gz: 32ab328c00d7568a7fb5fe7d668c851e836e55cb
3
+ metadata.gz: 8ec1b5c9bfc79b28575ac9681953bc1589aaec58
4
+ data.tar.gz: 9cae9d48dbb29ed1ccaeab79498b293caee9653a
5
5
  SHA512:
6
- metadata.gz: 684f93d1c35562cff81c3f455ab05886c75ca7695c6774bd36a8dfd9cc40d29961c149bd4a690bdf3e7277ee75b6b66a95b5f98d02bfa762eaea9e06bcb6f330
7
- data.tar.gz: 3944be97051efc763fdf2ec8c9c58c0d03b9fe35c3566297dfc1234c7b73d217cc93e971760e9a79b2c33842324d591195744bf079365b7745afc122bedbe8ff
6
+ metadata.gz: 35b2bde2067e5ce0e3c2eb863caa36c047ec88c6892b4a9590a9affbd34fc4199433759096f55c03d84b47710b8ad435f69f1ffb62e583a3a81d68edb3981d13
7
+ data.tar.gz: 855909206eebdcc7625cc2a0e21fce3966f6015b4bd441433cd7e59716489c75226982a44ee6e60fd408da655e6f68934e29995cea13ae4cf39201b5fc05dc75
@@ -6,13 +6,6 @@ module CoalescingPanda
6
6
  def lti_config
7
7
  lti_options = CoalescingPanda.lti_options
8
8
  lti_nav = CoalescingPanda.lti_paths
9
- lti_environments = CoalescingPanda.lti_environments
10
-
11
- if lti_environments.empty?
12
- render text: 'Domains must be set in lti_environments'
13
- return
14
- end
15
-
16
9
  lti_nav[:course][:text] = params[:course_navigation_label] if params[:course_navigation_label].present?
17
10
  lti_nav[:account][:text] = params[:account_navigation_label] if params[:account_navigation_label].present?
18
11
  platform = 'canvas.instructure.com'
@@ -31,8 +24,6 @@ module CoalescingPanda
31
24
  tc.set_ext_param(platform, setting_name(k.to_s), ext_params(v))
32
25
  end
33
26
 
34
- tc.set_ext_param(platform, :environments, lti_environments)
35
-
36
27
  #strip the launch url
37
28
  xml = tc.to_xml
38
29
  xml = xml.sub(/<blti:launch_url>.*<\/blti:launch_url>/, '') if lti_options[:launch_route].blank?
@@ -69,4 +60,4 @@ module CoalescingPanda
69
60
  end
70
61
 
71
62
  end
72
- end
63
+ end
@@ -7,24 +7,19 @@ module CoalescingPanda
7
7
  end
8
8
 
9
9
  def redirect
10
- if !params[:error] && retrieve_oauth_state
11
- lti_account = LtiAccount.find_by_key(@oauth_state.data[:key])
10
+ if !params[:error] && valid_state_token
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
14
- user_id = @oauth_state.data[:user_id]
15
- api_domain = @oauth_state.data[:api_domain]
16
- @oauth_state.destroy
17
- prefix = [oauth2_protocol, '://', api_domain].join
18
- Rails.logger.info "Creating Bearcat client for auth token retrieval pointed to: #{prefix}"
19
- client = Bearcat::Client.new(prefix: prefix)
20
- token_body = client.retrieve_token(client_id, coalescing_panda.oauth2_redirect_url, client_key, params['code'])
21
- auth = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, api_domain).first_or_initialize
22
- auth.api_token = token_body['access_token']
23
- auth.refresh_token = token_body['refresh_token']
24
- auth.expires_at = Time.now + token_body['expires_in'] if token_body['expires_in']
25
- auth.user_id = user_id
26
- auth.api_domain = api_domain
27
- auth.save!
14
+ user_id = params[:user_id]
15
+ api_domain = params[:api_domain]
16
+ client = Bearcat::Client.new(prefix: oauth2_protocol+'://'+api_domain)
17
+ token = client.retrieve_token(client_id, coalescing_panda.oauth2_redirect_url, client_key, params['code'])
18
+ CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, api_domain).first_or_create do |auth|
19
+ auth.api_token = token
20
+ auth.user_id = user_id
21
+ auth.api_domain = api_domain
22
+ end
28
23
  end
29
24
  end
30
25
 
@@ -35,10 +30,6 @@ module CoalescingPanda
35
30
  ENV['OAUTH_PROTOCOL'] || 'https'
36
31
  end
37
32
 
38
- def retrieve_oauth_state
39
- @oauth_state ||= params[:state].present? && OauthState.find_by(state_key: params[:state])
40
- end
41
-
42
33
  def valid_state_token
43
34
  return false unless params['state'].present? && session['state'].present?
44
35
  params['state'] == session['state']
@@ -3,9 +3,7 @@ module CoalescingPanda
3
3
  validates :user_id, :api_domain, presence: true
4
4
  validates :user_id, uniqueness: {scope: :api_domain}
5
5
 
6
- def expired?
7
- expires_at && expires_at < Time.now
8
- end
6
+ attr_accessible :user_id, :api_domain
9
7
  end
10
8
 
11
9
  end
@@ -6,6 +6,7 @@ module CoalescingPanda
6
6
  :foreign_key => :coalescing_panda_lti_account_id,
7
7
  :class_name => 'CoalescingPanda::LtiNonce'
8
8
 
9
+ attr_accessible :name, :key, :secret, :oauth2_client_id, :oauth2_client_key, :settings
9
10
  serialize :settings
10
11
 
11
12
  def validate_nonce(nonce, timestamp)
@@ -15,7 +15,6 @@ module CoalescingPanda
15
15
  @@lti_navigation = {}
16
16
  @@staged_navigation = {}
17
17
  @@lti_options = {}
18
- @@lti_environments = {}
19
18
 
20
19
  def self.lti_options= lti_options
21
20
  @@lti_options = lti_options
@@ -25,14 +24,6 @@ module CoalescingPanda
25
24
  @@lti_options.deep_dup
26
25
  end
27
26
 
28
- def self.lti_environments=(lti_environments)
29
- @@lti_environments = lti_environments
30
- end
31
-
32
- def self.lti_environments
33
- @@lti_environments.deep_dup
34
- end
35
-
36
27
  def self.register_navigation(navigation)
37
28
  @@lti_navigation[navigation] ||= {}
38
29
  end
@@ -7,73 +7,34 @@ 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
- launch_presentation_return_url = [BearcatUri.new(request.env["HTTP_REFERER"]).prefix, launch_presentation_return_url].join unless launch_presentation_return_url.include?('http')
11
- uri = BearcatUri.new(launch_presentation_return_url)
12
- set_session(launch_presentation_return_url)
13
-
14
- api_auth = CanvasApiAuth.find_by('user_id = ? and api_domain = ?', user_id, uri.api_domain)
15
- if api_auth
16
- begin
17
- refresh_token(uri, api_auth) if api_auth.expired?
18
- @client = Bearcat::Client.new(token: api_auth.api_token, prefix: uri.prefix)
19
- @client.user_profile 'self'
20
- rescue Footrest::HttpError::BadRequest, Footrest::HttpError::Unauthorized
21
- # If we can't retrieve our own user profile, or the token refresh fails, something is awry on the canvas end
22
- # and we'll need to go through the oauth flow again
23
- render_oauth2_page uri, user_id
24
- end
25
- else
26
- render_oauth2_page uri, user_id
10
+ uri = URI.parse(launch_presentation_return_url)
11
+ api_domain = uri.host
12
+ api_domain = "#{api_domain}:#{uri.port.to_s}" if uri.port
13
+ scheme = uri.scheme + '://'
14
+ @lti_params = params.to_hash
15
+ session['user_id'] = user_id
16
+ session['uri'] = launch_presentation_return_url
17
+ session['lis_person_sourcedid'] = params['lis_person_sourcedid']
18
+ session['oauth_consumer_key'] = params['oauth_consumer_key']
19
+ session['custom_canvas_account_id'] = params['custom_canvas_account_id']
20
+
21
+ if token = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, api_domain).pluck(:api_token).first
22
+ @client = Bearcat::Client.new(token: token, prefix: scheme+api_domain)
23
+ elsif @lti_account = params['oauth_consumer_key'] && LtiAccount.find_by_key(params['oauth_consumer_key'])
24
+ client_id = @lti_account.oauth2_client_id
25
+ client = Bearcat::Client.new(prefix: scheme+api_domain)
26
+ session['state'] = SecureRandom.hex(32)
27
+ @canvas_url = client.auth_redirect_url(client_id,
28
+ coalescing_panda.oauth2_redirect_url({key: params['oauth_consumer_key'],
29
+ user_id: user_id, api_domain: api_domain, state: session['state']}))
30
+ #delete the added params so the original oauth sig still works
31
+ @lti_params.delete('action')
32
+ @lti_params.delete('controller')
33
+ render 'coalescing_panda/oauth2/oauth2'
27
34
  end
28
35
  end
29
36
  end
30
37
 
31
- def render_oauth2_page(uri, user_id)
32
- @lti_account = params['oauth_consumer_key'] && LtiAccount.find_by_key(params['oauth_consumer_key'])
33
- return unless @lti_account
34
-
35
- client_id = @lti_account.oauth2_client_id
36
- client = Bearcat::Client.new(prefix: uri.prefix)
37
- state = SecureRandom.hex(32)
38
- OauthState.create! state_key: state, data: { key: params['oauth_consumer_key'], user_id: user_id, api_domain: uri.api_domain }
39
- redirect_path = coalescing_panda.oauth2_redirect_path
40
- redirect_url = [coalescing_panda_url, redirect_path.sub(/^\/lti/, '')].join
41
- @canvas_url = client.auth_redirect_url(client_id, redirect_url, { state: state })
42
-
43
- #delete the added params so the original oauth sig still works
44
- @lti_params = params.to_hash
45
- @lti_params.delete('action')
46
- @lti_params.delete('controller')
47
- render 'coalescing_panda/oauth2/oauth2', layout: 'coalescing_panda/application'
48
- end
49
-
50
- def refresh_token(uri, api_auth)
51
- refresh_client = Bearcat::Client.new(prefix: uri.prefix)
52
- refresh_body = refresh_client.retrieve_token(@lti_account.oauth2_client_id, coalescing_panda.oauth2_redirect_url,
53
- @lti_account.oauth2_client_key, api_auth.refresh_token, 'refresh_token')
54
- api_auth.update({ api_token: refresh_body['access_token'], expires_at: (Time.now + refresh_body['expires_in']) })
55
- end
56
-
57
- def check_refresh_token
58
- return unless session['uri'] && session['user_id'] && session['oauth_consumer_key']
59
- uri = BearcatUri.new(session['uri'])
60
- api_auth = CanvasApiAuth.find_by(user_id: session['user_id'], api_domain: uri.api_domain)
61
- @lti_account = LtiAccount.find_by(key: session['oauth_consumer_key'])
62
- return if @lti_account.nil? || api_auth.nil? # Not all tools use oauth
63
-
64
- refresh_token(uri, api_auth) if api_auth.expired?
65
- rescue Footrest::HttpError::BadRequest
66
- render_oauth2_page uri, session['user_id']
67
- end
68
-
69
- def set_session(launch_presentation_return_url)
70
- session['user_id'] = params['user_id']
71
- session['uri'] = launch_presentation_return_url
72
- session['lis_person_sourcedid'] = params['lis_person_sourcedid']
73
- session['oauth_consumer_key'] = params['oauth_consumer_key']
74
- session['custom_canvas_account_id'] = params['custom_canvas_account_id']
75
- end
76
-
77
38
  def have_session?
78
39
  if params['tool_consumer_instance_guid'] && session['user_id'] != params['user_id']
79
40
  reset_session
@@ -82,19 +43,17 @@ module CoalescingPanda
82
43
  end
83
44
 
84
45
  if (session['user_id'] && session['uri'])
85
- uri = BearcatUri.new(session['uri'])
86
- api_auth = CanvasApiAuth.find_by('user_id = ? and api_domain = ?', session['user_id'], uri.api_domain)
87
- if api_auth && !api_auth.expired?
88
- @client = Bearcat::Client.new(token: api_auth.api_token, prefix: uri.prefix)
89
- @client.user_profile 'self'
90
- end
46
+ uri = URI.parse(session['uri'])
47
+ api_domain = uri.host
48
+ api_domain = "#{api_domain}:#{uri.port.to_s}" if uri.port
49
+ scheme = uri.scheme + '://'
50
+ token = CanvasApiAuth.where('user_id = ? and api_domain = ?', session['user_id'], api_domain).pluck(:api_token).first
51
+ @client = Bearcat::Client.new(token: token, prefix: scheme+api_domain) if token
91
52
  end
92
53
 
93
54
  @lti_account = LtiAccount.find_by_key(session['oauth_consumer_key']) if session['oauth_consumer_key']
94
55
 
95
56
  !!@client
96
- rescue Footrest::HttpError::Unauthorized
97
- false
98
57
  end
99
58
 
100
59
  def lti_authorize!(*roles)
@@ -108,12 +67,14 @@ module CoalescingPanda
108
67
  logger.info 'not authorized on roles' if !authorized
109
68
  authorized = authorized && @lti_account.validate_nonce(params['oauth_nonce'], DateTime.strptime(params['oauth_timestamp'], '%s'))
110
69
  logger.info 'not authorized on nonce' if !authorized
111
- render :text => 'Invalid Credentials, please contact your Administrator.', :status => :unauthorized unless authorized
70
+ if !authorized
71
+ render :text => 'Invalid Credentials, please contact your Administrator.', :status => :unauthorized
72
+ end
112
73
  authorized
113
74
  end
114
75
 
115
76
  def lti_editor_button_response(return_type, return_params)
116
- valid_return_types = [:image_url, :iframe, :url, :lti_launch_url]
77
+ valid_return_types = [:image_url, :iframe, :url]
117
78
  raise "invalid editor button return type #{return_type}" unless valid_return_types.include?(return_type)
118
79
  return_params[:return_type] = return_type.to_s
119
80
  return_url = "#{params['launch_presentation_return_url']}?#{return_params.to_query}"
@@ -154,7 +115,7 @@ module CoalescingPanda
154
115
 
155
116
  def session_check
156
117
  user_agent = UserAgent.parse(request.user_agent) # Uses useragent gem!
157
- if user_agent.browser == 'Safari' && !request.referrer.include?('sessionless_launch') # we apply the fix..
118
+ if user_agent.browser == 'Safari' # we apply the fix..
158
119
  return if session[:safari_cookie_fixed] # it is already fixed.. continue
159
120
  if params[:safari_cookie_fix].present? # we should be top window and able to set cookies.. so fix the issue :)
160
121
  session[:safari_cookie_fixed] = true
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '1.4.1'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -1,13 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CoalescingPanda::LtiController, type: :controller do
3
+ describe CoalescingPanda::LtiController do
4
4
  routes { CoalescingPanda::Engine.routes }
5
5
 
6
6
  describe '#lti_config' do
7
- before :each do
8
- CoalescingPanda.class_variable_set(:@@lti_navigation, {})
9
- CoalescingPanda.lti_environments = { test_domain: 'test' }
10
- end
11
7
 
12
8
  it 'generates lti xml config'do
13
9
  controller.main_app.stub(:test_action_url) {'foo'}
@@ -35,19 +31,14 @@ describe CoalescingPanda::LtiController, type: :controller do
35
31
  account_nav.at_xpath('lticm:property[@name="url"]').text.should == 'foo'
36
32
  end
37
33
 
38
- it 'includes environment information' do
39
- get(:lti_config)
40
- xml = Nokogiri::XML(response.body)
41
- environments = xml.at_xpath('//lticm:options[@name="environments"]')
42
- environments.at_xpath('lticm:property[@name="test_domain"]').text.should == 'test'
43
- end
44
-
45
34
  end
46
35
 
36
+
47
37
  it 'get the url, from the action string' do
48
38
  controller.main_app.stub(:test_action_url) {'foo'}
49
39
  options = controller.send(:ext_params, {url:'test_action'})
50
40
  options[:url].should == 'foo'
51
41
  end
52
42
 
53
- end
43
+
44
+ end
@@ -1,20 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CoalescingPanda::Oauth2Controller, type: :controller do
3
+ describe CoalescingPanda::Oauth2Controller do
4
4
  routes { CoalescingPanda::Engine.routes }
5
- let(:account) { FactoryGirl.create(:account, settings: {base_url: 'foo.com'}) }
6
5
 
7
6
  describe "#redirect" do
8
7
  it 'creates a token in the db' do
9
8
  ENV['OAUTH_PROTOCOL'] = 'http'
10
- Bearcat::Client.any_instance.stub(retrieve_token: { 'access_token' => 'token', 'refresh_token' => 'token', 'expires_in' => 3600 })
11
- session[:state] = 'test'
12
- get :redirect, {user_id: 1, api_domain: 'foo.com', code: 'bar', key: account.key, state: 'test'}
9
+ Bearcat::Client.any_instance.stub(retrieve_token: 'foobar')
10
+ get :redirect, {user_id: 1, api_domain:'foo.com', code:'bar'}
13
11
  auth = CoalescingPanda::CanvasApiAuth.find_by_user_id_and_api_domain(1, 'foo.com')
14
12
  auth.should_not == nil
15
- expect(auth.api_token).to eql 'token'
16
- expect(auth.refresh_token).to eql 'token'
17
- expect(auth.expires_at).to be > 50.minutes.from_now
18
13
  end
19
14
 
20
15
  it "doesn't create a token in the db" do
@@ -24,4 +19,4 @@ describe CoalescingPanda::Oauth2Controller, type: :controller do
24
19
 
25
20
  end
26
21
 
27
- end
22
+ end
File without changes
@@ -6,16 +6,6 @@ describe CoalescingPanda::CanvasApiAuth do
6
6
  it { should validate_presence_of(:user_id)}
7
7
  it {should validate_presence_of(:api_domain)}
8
8
 
9
- describe '#expired?' do
10
- let(:auth) { FactoryGirl.create :canvas_api_auth }
11
9
 
12
- it 'is not expired if expires_at is null or in the future' do
13
- auth.expires_at = nil
14
- expect(auth.expired?).to be_falsey
15
- auth.expires_at = 1.hour.ago
16
- expect(auth.expired?).to be_truthy
17
- auth.expires_at = 1.hour.from_now
18
- expect(auth.expired?).to be_falsey
19
- end
20
- end
21
10
  end
11
+
data/spec/spec_helper.rb CHANGED
@@ -2,11 +2,10 @@ ENV["RAILS_ENV"] ||= 'test'
2
2
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
3
3
  require 'rspec/rails'
4
4
  require 'rspec/autorun'
5
- require 'shoulda/matchers'
5
+ require 'shoulda/matchers/integrations/rspec'
6
6
  require 'nokogiri'
7
7
  require 'haml'
8
8
  require 'simplecov'
9
- require 'factory_girl_rails'
10
9
 
11
10
  SimpleCov.start
12
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-17 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.0
33
+ version: 1.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.0
40
+ version: 1.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: macaddr
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -262,20 +262,6 @@ dependencies:
262
262
  - - '>='
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0'
265
- - !ruby/object:Gem::Dependency
266
- name: factory_girl_rails
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - '>='
270
- - !ruby/object:Gem::Version
271
- version: '0'
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - '>='
277
- - !ruby/object:Gem::Version
278
- version: '0'
279
265
  description:
280
266
  email:
281
267
  - nathanm@instructure.com
@@ -283,7 +269,6 @@ executables: []
283
269
  extensions: []
284
270
  extra_rdoc_files: []
285
271
  files:
286
- - Rakefile
287
272
  - app/assets/images/bootstrap/glyphicons-halflings-white.png
288
273
  - app/assets/images/bootstrap/glyphicons-halflings.png
289
274
  - app/assets/javascripts/bootstrap/bootstrap-datepicker.js
@@ -303,7 +288,6 @@ files:
303
288
  - app/models/coalescing_panda/canvas_api_auth.rb
304
289
  - app/models/coalescing_panda/lti_account.rb
305
290
  - app/models/coalescing_panda/lti_nonce.rb
306
- - app/models/coalescing_panda/oauth_state.rb
307
291
  - app/models/coalescing_panda/session.rb
308
292
  - app/views/coalescing_panda/launch.html.haml
309
293
  - app/views/coalescing_panda/oauth2/oauth2.html.haml
@@ -317,19 +301,15 @@ files:
317
301
  - db/migrate/20131119165343_create_coalescing_panda_lti_nonces.rb
318
302
  - db/migrate/20140722210735_add_settings_to_coalescing_panda_lti_account.rb
319
303
  - db/migrate/20140904223159_create_coalescing_panda_sessions.rb
320
- - db/migrate/20151209155923_add_refresh_settings_to_canvas_api_auth.rb
321
- - db/migrate/20160830183155_create_coalescing_panda_oauth_states.rb
322
- - lib/coalescing_panda.rb
323
- - lib/coalescing_panda/bearcat_uri.rb
324
304
  - lib/coalescing_panda/controller_helpers.rb
325
305
  - lib/coalescing_panda/engine.rb
326
306
  - lib/coalescing_panda/route_helpers.rb
327
307
  - lib/coalescing_panda/version.rb
308
+ - lib/coalescing_panda.rb
328
309
  - lib/tasks/coalescing_panda_tasks.rake
310
+ - Rakefile
329
311
  - spec/controllers/coalescing_panda/lti_controller_spec.rb
330
312
  - spec/controllers/coalescing_panda/oauth2_controller_spec.rb
331
- - spec/dummy/README.rdoc
332
- - spec/dummy/Rakefile
333
313
  - spec/dummy/app/assets/javascripts/application.js
334
314
  - spec/dummy/app/assets/stylesheets/application.css
335
315
  - spec/dummy/app/controllers/application_controller.rb
@@ -338,7 +318,6 @@ files:
338
318
  - spec/dummy/bin/bundle
339
319
  - spec/dummy/bin/rails
340
320
  - spec/dummy/bin/rake
341
- - spec/dummy/config.ru
342
321
  - spec/dummy/config/application.rb
343
322
  - spec/dummy/config/boot.rb
344
323
  - spec/dummy/config/database.yml
@@ -356,14 +335,15 @@ files:
356
335
  - spec/dummy/config/initializers/wrap_parameters.rb
357
336
  - spec/dummy/config/locales/en.yml
358
337
  - spec/dummy/config/routes.rb
338
+ - spec/dummy/config.ru
359
339
  - spec/dummy/db/schema.rb
360
- - spec/dummy/db/test.sqlite3
340
+ - spec/dummy/log/development.log
361
341
  - spec/dummy/public/404.html
362
342
  - spec/dummy/public/422.html
363
343
  - spec/dummy/public/500.html
364
344
  - spec/dummy/public/favicon.ico
365
- - spec/factories/accounts.rb
366
- - spec/factories/canvas_api_auths.rb
345
+ - spec/dummy/Rakefile
346
+ - spec/dummy/README.rdoc
367
347
  - spec/models/coalescing_panda/canvas_api_auth_spec.rb
368
348
  - spec/spec_helper.rb
369
349
  homepage: http://www.instructure.com
@@ -385,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
365
  version: '0'
386
366
  requirements: []
387
367
  rubyforge_project:
388
- rubygems_version: 2.4.6
368
+ rubygems_version: 2.0.3
389
369
  signing_key:
390
370
  specification_version: 4
391
371
  summary: Canvas LTI and OAUTH2 mountable engine
@@ -419,14 +399,13 @@ test_files:
419
399
  - spec/dummy/config/routes.rb
420
400
  - spec/dummy/config.ru
421
401
  - spec/dummy/db/schema.rb
422
- - spec/dummy/db/test.sqlite3
402
+ - spec/dummy/log/development.log
423
403
  - spec/dummy/public/404.html
424
404
  - spec/dummy/public/422.html
425
405
  - spec/dummy/public/500.html
426
406
  - spec/dummy/public/favicon.ico
427
407
  - spec/dummy/Rakefile
428
408
  - spec/dummy/README.rdoc
429
- - spec/factories/accounts.rb
430
- - spec/factories/canvas_api_auths.rb
431
409
  - spec/models/coalescing_panda/canvas_api_auth_spec.rb
432
410
  - spec/spec_helper.rb
411
+ has_rdoc:
@@ -1,8 +0,0 @@
1
- module CoalescingPanda
2
- class OauthState < ActiveRecord::Base
3
- serialize :data, Hash
4
- validates :state_key, presence: true, uniqueness: true
5
-
6
- attr_accessible :state_key, :data
7
- end
8
- end
@@ -1,6 +0,0 @@
1
- class AddRefreshSettingsToCanvasApiAuth < ActiveRecord::Migration
2
- def change
3
- add_column :coalescing_panda_canvas_api_auths, :refresh_token, :string
4
- add_column :coalescing_panda_canvas_api_auths, :expires_at, :datetime
5
- end
6
- end
@@ -1,11 +0,0 @@
1
- class CreateCoalescingPandaOauthStates < ActiveRecord::Migration
2
- def change
3
- create_table :coalescing_panda_oauth_states do |t|
4
- t.string :state_key
5
- t.text :data
6
-
7
- t.timestamps
8
- end
9
- add_index :coalescing_panda_oauth_states, :state_key, unique: true
10
- end
11
- end
@@ -1,24 +0,0 @@
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
- if Rails.env.test? or Rails.env.development?
11
- uri.port.present? ? URI.encode("#{uri.host}:#{uri.port.to_s}") : uri.host
12
- else
13
- uri.host
14
- end
15
- end
16
-
17
- def scheme
18
- [uri.scheme, '://'].join
19
- end
20
-
21
- def prefix
22
- [scheme, api_domain].join
23
- end
24
- end
Binary file
@@ -1,24 +0,0 @@
1
- FactoryGirl.define do
2
- factory :account, class: CoalescingPanda::LtiAccount do
3
- sequence :name do |n|
4
- "Account #{n}"
5
- end
6
-
7
- sequence :key do |n|
8
- "Key #{n}"
9
- end
10
-
11
- sequence :secret do |n|
12
- "Account #{n}"
13
- end
14
-
15
- sequence :canvas_account_id do |n|
16
- "#{n}"
17
- end
18
-
19
- oauth2_client_id "1234"
20
- oauth2_client_key "thisisadeveloperkey"
21
- settings { {base_url: "http://localhost:3000", account_admin_api_token: "9q2083uy4poiahjfgpoawy"} }
22
-
23
- end
24
- end
@@ -1,9 +0,0 @@
1
- FactoryGirl.define do
2
- factory :canvas_api_auth, class: CoalescingPanda::CanvasApiAuth do
3
- user_id 'abcd'
4
- api_domain 'test.example'
5
- api_token 'token'
6
- refresh_token 'token'
7
- expires_at { 1.day.from_now }
8
- end
9
- end