dce_lti 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +154 -0
  4. data/Rakefile +19 -0
  5. data/app/assets/javascripts/dce_lti/application.js +13 -0
  6. data/app/assets/stylesheets/dce_lti/application.css +15 -0
  7. data/app/concerns/dce_lti/session_helpers.rb +55 -0
  8. data/app/controllers/dce_lti/application_controller.rb +5 -0
  9. data/app/controllers/dce_lti/configs_controller.rb +26 -0
  10. data/app/controllers/dce_lti/sessions_controller.rb +20 -0
  11. data/app/helpers/dce_lti/application_helper.rb +4 -0
  12. data/app/models/dce_lti/nonce.rb +17 -0
  13. data/app/models/dce_lti/user.rb +16 -0
  14. data/app/services/dce_lti/timestamp_validator.rb +7 -0
  15. data/app/services/dce_lti/user_initializer.rb +22 -0
  16. data/app/views/dce_lti/sessions/invalid.html.erb +4 -0
  17. data/app/views/layouts/dce_lti/application.html.erb +14 -0
  18. data/config/routes.rb +9 -0
  19. data/db/migrate/20141003180140_create_dce_lti_users.rb +16 -0
  20. data/db/migrate/20141008172001_create_dce_lti_nonces.rb +10 -0
  21. data/lib/dce_lti/controller_methods.rb +18 -0
  22. data/lib/dce_lti/engine.rb +30 -0
  23. data/lib/dce_lti/version.rb +3 -0
  24. data/lib/dce_lti.rb +5 -0
  25. data/lib/tasks/dce_lti_tasks.rake +34 -0
  26. data/spec/controllers/dce_lti/configs_controller_spec.rb +71 -0
  27. data/spec/controllers/dce_lti/sessions_controller_spec.rb +201 -0
  28. data/spec/controllers/embedding_headers_are_correct_spec.rb +8 -0
  29. data/spec/controllers/posts_controller_spec.rb +22 -0
  30. data/spec/dummy/README.rdoc +28 -0
  31. data/spec/dummy/Rakefile +6 -0
  32. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  33. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  34. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  35. data/spec/dummy/app/controllers/posts_controller.rb +6 -0
  36. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  37. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  38. data/spec/dummy/bin/bundle +3 -0
  39. data/spec/dummy/bin/rails +4 -0
  40. data/spec/dummy/bin/rake +4 -0
  41. data/spec/dummy/config/application.rb +29 -0
  42. data/spec/dummy/config/boot.rb +5 -0
  43. data/spec/dummy/config/database.yml +19 -0
  44. data/spec/dummy/config/environment.rb +5 -0
  45. data/spec/dummy/config/environments/development.rb +37 -0
  46. data/spec/dummy/config/environments/production.rb +82 -0
  47. data/spec/dummy/config/environments/test.rb +39 -0
  48. data/spec/dummy/config/initializers/assets.rb +8 -0
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  50. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  51. data/spec/dummy/config/initializers/dce_lti_config.rb +40 -0
  52. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  53. data/spec/dummy/config/initializers/inflections.rb +16 -0
  54. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  55. data/spec/dummy/config/initializers/session_store.rb +3 -0
  56. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/spec/dummy/config/initializers/x_frame_options.rb +9 -0
  58. data/spec/dummy/config/locales/en.yml +23 -0
  59. data/spec/dummy/config/routes.rb +7 -0
  60. data/spec/dummy/config/secrets.yml +22 -0
  61. data/spec/dummy/config.ru +4 -0
  62. data/spec/dummy/db/schema.rb +40 -0
  63. data/spec/dummy/log/development.log +2875 -0
  64. data/spec/dummy/log/test.log +108620 -0
  65. data/spec/dummy/public/404.html +67 -0
  66. data/spec/dummy/public/422.html +67 -0
  67. data/spec/dummy/public/500.html +66 -0
  68. data/spec/dummy/public/favicon.ico +0 -0
  69. data/spec/factories.rb +7 -0
  70. data/spec/models/dce_lti/nonce_spec.rb +42 -0
  71. data/spec/models/dce_lti/user_spec.rb +71 -0
  72. data/spec/services/dce_lti/timestamp_validator_spec.rb +15 -0
  73. data/spec/services/dce_lti/user_initializer_spec.rb +58 -0
  74. data/spec/spec_helper.rb +25 -0
  75. data/spec/support/database_cleaner.rb +21 -0
  76. data/spec/support/dce_lti/configuration_helpers.rb +36 -0
  77. data/spec/support/factory_girl.rb +3 -0
  78. metadata +327 -0
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,9 @@
1
+ # This ensures the application can be displayed in an iframe
2
+ Rails.application.config.x_frame_options = (ENV['X_Frame_Options'])
3
+
4
+ if Rails.application.config.x_frame_options.present?
5
+ Rails.application.config.action_dispatch.default_headers['X-Frame-Options'] =\
6
+ Rails.application.config.x_frame_options
7
+ else
8
+ Rails.application.config.action_dispatch.default_headers.delete('X-Frame-Options')
9
+ end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,7 @@
1
+ Rails.application.routes.draw do
2
+ mount DceLti::Engine => "/dce_lti"
3
+
4
+ resources :posts, only: [:index]
5
+
6
+ root to: 'posts#index'
7
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 91e4bc2aa792050f40e4e4d93206d26b71217aad8015c06aa853f83596330941d7fae5bd5a26b096ecf9151f899b87970e72199177a8682f595f429a6e788a7d
15
+
16
+ test:
17
+ secret_key_base: baf3abf0334893e6de4a6e8b9460ded8efe9af09aaccd493bd7b425a3636782bfae25b03c0b4f0209cb0b042350b4afe2036288806d62949157a2a9e4c485cf2
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,40 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20141008172001) do
15
+
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
18
+
19
+ create_table "dce_lti_nonces", force: true do |t|
20
+ t.string "nonce"
21
+ t.datetime "created_at"
22
+ t.datetime "updated_at"
23
+ end
24
+
25
+ add_index "dce_lti_nonces", ["nonce"], name: "index_dce_lti_nonces_on_nonce", unique: true, using: :btree
26
+
27
+ create_table "dce_lti_users", force: true do |t|
28
+ t.string "lti_user_id"
29
+ t.string "lis_person_contact_email_primary"
30
+ t.string "lis_person_name_family"
31
+ t.string "lis_person_name_full"
32
+ t.string "lis_person_name_given"
33
+ t.string "lis_person_sourcedid"
34
+ t.string "user_image"
35
+ t.string "roles", default: [], array: true
36
+ t.datetime "created_at"
37
+ t.datetime "updated_at"
38
+ end
39
+
40
+ end