big_session 0.1.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.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +32 -0
  3. data/.rubocop.yml +10 -0
  4. data/Gemfile +8 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +60 -0
  7. data/Rakefile +8 -0
  8. data/big_session.gemspec +44 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/examples/landing_page_app_and_core_app/README.md +3 -0
  12. data/examples/landing_page_app_and_core_app/app_core/.ruby-version +1 -0
  13. data/examples/landing_page_app_and_core_app/app_core/Dockerfile +22 -0
  14. data/examples/landing_page_app_and_core_app/app_core/Gemfile +66 -0
  15. data/examples/landing_page_app_and_core_app/app_core/Gemfile.lock +236 -0
  16. data/examples/landing_page_app_and_core_app/app_core/README.md +24 -0
  17. data/examples/landing_page_app_and_core_app/app_core/Rakefile +6 -0
  18. data/examples/landing_page_app_and_core_app/app_core/app/assets/config/manifest.js +3 -0
  19. data/examples/landing_page_app_and_core_app/app_core/app/assets/images/.keep +0 -0
  20. data/examples/landing_page_app_and_core_app/app_core/app/assets/javascripts/application.js +16 -0
  21. data/examples/landing_page_app_and_core_app/app_core/app/assets/javascripts/cable.js +13 -0
  22. data/examples/landing_page_app_and_core_app/app_core/app/assets/javascripts/channels/.keep +0 -0
  23. data/examples/landing_page_app_and_core_app/app_core/app/assets/stylesheets/application.css +15 -0
  24. data/examples/landing_page_app_and_core_app/app_core/app/channels/application_cable/channel.rb +4 -0
  25. data/examples/landing_page_app_and_core_app/app_core/app/channels/application_cable/connection.rb +4 -0
  26. data/examples/landing_page_app_and_core_app/app_core/app/controllers/application_controller.rb +12 -0
  27. data/examples/landing_page_app_and_core_app/app_core/app/controllers/concerns/.keep +0 -0
  28. data/examples/landing_page_app_and_core_app/app_core/app/controllers/conversions_controller.rb +8 -0
  29. data/examples/landing_page_app_and_core_app/app_core/app/helpers/application_helper.rb +2 -0
  30. data/examples/landing_page_app_and_core_app/app_core/app/jobs/application_job.rb +2 -0
  31. data/examples/landing_page_app_and_core_app/app_core/app/mailers/application_mailer.rb +4 -0
  32. data/examples/landing_page_app_and_core_app/app_core/app/models/application_record.rb +3 -0
  33. data/examples/landing_page_app_and_core_app/app_core/app/models/concerns/.keep +0 -0
  34. data/examples/landing_page_app_and_core_app/app_core/app/views/layouts/application.html.erb +15 -0
  35. data/examples/landing_page_app_and_core_app/app_core/app/views/layouts/mailer.html.erb +13 -0
  36. data/examples/landing_page_app_and_core_app/app_core/app/views/layouts/mailer.text.erb +1 -0
  37. data/examples/landing_page_app_and_core_app/app_core/bin/bundle +3 -0
  38. data/examples/landing_page_app_and_core_app/app_core/bin/rails +9 -0
  39. data/examples/landing_page_app_and_core_app/app_core/bin/rake +9 -0
  40. data/examples/landing_page_app_and_core_app/app_core/bin/setup +36 -0
  41. data/examples/landing_page_app_and_core_app/app_core/bin/spring +17 -0
  42. data/examples/landing_page_app_and_core_app/app_core/bin/update +31 -0
  43. data/examples/landing_page_app_and_core_app/app_core/bin/yarn +11 -0
  44. data/examples/landing_page_app_and_core_app/app_core/config.ru +5 -0
  45. data/examples/landing_page_app_and_core_app/app_core/config/application.rb +19 -0
  46. data/examples/landing_page_app_and_core_app/app_core/config/boot.rb +4 -0
  47. data/examples/landing_page_app_and_core_app/app_core/config/cable.yml +10 -0
  48. data/examples/landing_page_app_and_core_app/app_core/config/credentials.yml.enc +1 -0
  49. data/examples/landing_page_app_and_core_app/app_core/config/database.yml +88 -0
  50. data/examples/landing_page_app_and_core_app/app_core/config/environment.rb +5 -0
  51. data/examples/landing_page_app_and_core_app/app_core/config/environments/development.rb +78 -0
  52. data/examples/landing_page_app_and_core_app/app_core/config/environments/production.rb +94 -0
  53. data/examples/landing_page_app_and_core_app/app_core/config/environments/test.rb +46 -0
  54. data/examples/landing_page_app_and_core_app/app_core/config/initializers/application_controller_renderer.rb +8 -0
  55. data/examples/landing_page_app_and_core_app/app_core/config/initializers/assets.rb +14 -0
  56. data/examples/landing_page_app_and_core_app/app_core/config/initializers/backtrace_silencers.rb +7 -0
  57. data/examples/landing_page_app_and_core_app/app_core/config/initializers/big_session.rb +7 -0
  58. data/examples/landing_page_app_and_core_app/app_core/config/initializers/content_security_policy.rb +25 -0
  59. data/examples/landing_page_app_and_core_app/app_core/config/initializers/cookies_serializer.rb +5 -0
  60. data/examples/landing_page_app_and_core_app/app_core/config/initializers/filter_parameter_logging.rb +4 -0
  61. data/examples/landing_page_app_and_core_app/app_core/config/initializers/inflections.rb +16 -0
  62. data/examples/landing_page_app_and_core_app/app_core/config/initializers/mime_types.rb +4 -0
  63. data/examples/landing_page_app_and_core_app/app_core/config/initializers/wrap_parameters.rb +14 -0
  64. data/examples/landing_page_app_and_core_app/app_core/config/locales/en.yml +33 -0
  65. data/examples/landing_page_app_and_core_app/app_core/config/puma.rb +34 -0
  66. data/examples/landing_page_app_and_core_app/app_core/config/routes.rb +4 -0
  67. data/examples/landing_page_app_and_core_app/app_core/config/spring.rb +6 -0
  68. data/examples/landing_page_app_and_core_app/app_core/config/storage.yml +34 -0
  69. data/examples/landing_page_app_and_core_app/app_core/db/seeds.rb +7 -0
  70. data/examples/landing_page_app_and_core_app/app_core/entrypoint.sh +8 -0
  71. data/examples/landing_page_app_and_core_app/app_core/lib/assets/.keep +0 -0
  72. data/examples/landing_page_app_and_core_app/app_core/lib/tasks/.keep +0 -0
  73. data/examples/landing_page_app_and_core_app/app_core/log/.keep +0 -0
  74. data/examples/landing_page_app_and_core_app/app_core/package.json +5 -0
  75. data/examples/landing_page_app_and_core_app/app_core/public/404.html +67 -0
  76. data/examples/landing_page_app_and_core_app/app_core/public/422.html +67 -0
  77. data/examples/landing_page_app_and_core_app/app_core/public/500.html +66 -0
  78. data/examples/landing_page_app_and_core_app/app_core/public/apple-touch-icon-precomposed.png +0 -0
  79. data/examples/landing_page_app_and_core_app/app_core/public/apple-touch-icon.png +0 -0
  80. data/examples/landing_page_app_and_core_app/app_core/public/favicon.ico +0 -0
  81. data/examples/landing_page_app_and_core_app/app_core/public/robots.txt +1 -0
  82. data/examples/landing_page_app_and_core_app/app_core/storage/.keep +0 -0
  83. data/examples/landing_page_app_and_core_app/app_core/test/application_system_test_case.rb +5 -0
  84. data/examples/landing_page_app_and_core_app/app_core/test/controllers/.keep +0 -0
  85. data/examples/landing_page_app_and_core_app/app_core/test/fixtures/.keep +0 -0
  86. data/examples/landing_page_app_and_core_app/app_core/test/fixtures/files/.keep +0 -0
  87. data/examples/landing_page_app_and_core_app/app_core/test/helpers/.keep +0 -0
  88. data/examples/landing_page_app_and_core_app/app_core/test/integration/.keep +0 -0
  89. data/examples/landing_page_app_and_core_app/app_core/test/mailers/.keep +0 -0
  90. data/examples/landing_page_app_and_core_app/app_core/test/models/.keep +0 -0
  91. data/examples/landing_page_app_and_core_app/app_core/test/system/.keep +0 -0
  92. data/examples/landing_page_app_and_core_app/app_core/test/test_helper.rb +10 -0
  93. data/examples/landing_page_app_and_core_app/app_core/tmp/.keep +0 -0
  94. data/examples/landing_page_app_and_core_app/app_core/vendor/.keep +0 -0
  95. data/examples/landing_page_app_and_core_app/app_lp/.ruby-version +1 -0
  96. data/examples/landing_page_app_and_core_app/app_lp/Dockerfile +22 -0
  97. data/examples/landing_page_app_and_core_app/app_lp/Gemfile +66 -0
  98. data/examples/landing_page_app_and_core_app/app_lp/Gemfile.lock +256 -0
  99. data/examples/landing_page_app_and_core_app/app_lp/README.md +24 -0
  100. data/examples/landing_page_app_and_core_app/app_lp/Rakefile +6 -0
  101. data/examples/landing_page_app_and_core_app/app_lp/app/assets/config/manifest.js +3 -0
  102. data/examples/landing_page_app_and_core_app/app_lp/app/assets/images/.keep +0 -0
  103. data/examples/landing_page_app_and_core_app/app_lp/app/assets/javascripts/application.js +16 -0
  104. data/examples/landing_page_app_and_core_app/app_lp/app/assets/javascripts/cable.js +13 -0
  105. data/examples/landing_page_app_and_core_app/app_lp/app/assets/javascripts/channels/.keep +0 -0
  106. data/examples/landing_page_app_and_core_app/app_lp/app/assets/stylesheets/application.css +15 -0
  107. data/examples/landing_page_app_and_core_app/app_lp/app/channels/application_cable/channel.rb +4 -0
  108. data/examples/landing_page_app_and_core_app/app_lp/app/channels/application_cable/connection.rb +4 -0
  109. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/application_controller.rb +10 -0
  110. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/concerns/.keep +0 -0
  111. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/conversions_controller.rb +13 -0
  112. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/lps_controller.rb +3 -0
  113. data/examples/landing_page_app_and_core_app/app_lp/app/helpers/application_helper.rb +2 -0
  114. data/examples/landing_page_app_and_core_app/app_lp/app/jobs/application_job.rb +2 -0
  115. data/examples/landing_page_app_and_core_app/app_lp/app/mailers/application_mailer.rb +4 -0
  116. data/examples/landing_page_app_and_core_app/app_lp/app/models/application_record.rb +3 -0
  117. data/examples/landing_page_app_and_core_app/app_lp/app/models/concerns/.keep +0 -0
  118. data/examples/landing_page_app_and_core_app/app_lp/app/views/layouts/application.html.erb +15 -0
  119. data/examples/landing_page_app_and_core_app/app_lp/app/views/layouts/mailer.html.erb +13 -0
  120. data/examples/landing_page_app_and_core_app/app_lp/app/views/layouts/mailer.text.erb +1 -0
  121. data/examples/landing_page_app_and_core_app/app_lp/app/views/lps/show.html.haml +5 -0
  122. data/examples/landing_page_app_and_core_app/app_lp/bin/bundle +3 -0
  123. data/examples/landing_page_app_and_core_app/app_lp/bin/rails +9 -0
  124. data/examples/landing_page_app_and_core_app/app_lp/bin/rake +9 -0
  125. data/examples/landing_page_app_and_core_app/app_lp/bin/setup +36 -0
  126. data/examples/landing_page_app_and_core_app/app_lp/bin/spring +17 -0
  127. data/examples/landing_page_app_and_core_app/app_lp/bin/update +31 -0
  128. data/examples/landing_page_app_and_core_app/app_lp/bin/yarn +11 -0
  129. data/examples/landing_page_app_and_core_app/app_lp/config.ru +5 -0
  130. data/examples/landing_page_app_and_core_app/app_lp/config/application.rb +19 -0
  131. data/examples/landing_page_app_and_core_app/app_lp/config/boot.rb +4 -0
  132. data/examples/landing_page_app_and_core_app/app_lp/config/cable.yml +10 -0
  133. data/examples/landing_page_app_and_core_app/app_lp/config/credentials.yml.enc +1 -0
  134. data/examples/landing_page_app_and_core_app/app_lp/config/database.yml +88 -0
  135. data/examples/landing_page_app_and_core_app/app_lp/config/environment.rb +5 -0
  136. data/examples/landing_page_app_and_core_app/app_lp/config/environments/development.rb +77 -0
  137. data/examples/landing_page_app_and_core_app/app_lp/config/environments/production.rb +94 -0
  138. data/examples/landing_page_app_and_core_app/app_lp/config/environments/test.rb +46 -0
  139. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/application_controller_renderer.rb +8 -0
  140. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/assets.rb +14 -0
  141. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/backtrace_silencers.rb +7 -0
  142. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/big_session.rb +7 -0
  143. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/content_security_policy.rb +25 -0
  144. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/cookies_serializer.rb +5 -0
  145. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/filter_parameter_logging.rb +4 -0
  146. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/inflections.rb +16 -0
  147. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/mime_types.rb +4 -0
  148. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/wrap_parameters.rb +14 -0
  149. data/examples/landing_page_app_and_core_app/app_lp/config/locales/en.yml +33 -0
  150. data/examples/landing_page_app_and_core_app/app_lp/config/puma.rb +34 -0
  151. data/examples/landing_page_app_and_core_app/app_lp/config/routes.rb +5 -0
  152. data/examples/landing_page_app_and_core_app/app_lp/config/spring.rb +6 -0
  153. data/examples/landing_page_app_and_core_app/app_lp/config/storage.yml +34 -0
  154. data/examples/landing_page_app_and_core_app/app_lp/db/seeds.rb +7 -0
  155. data/examples/landing_page_app_and_core_app/app_lp/entrypoint.sh +8 -0
  156. data/examples/landing_page_app_and_core_app/app_lp/lib/assets/.keep +0 -0
  157. data/examples/landing_page_app_and_core_app/app_lp/lib/tasks/.keep +0 -0
  158. data/examples/landing_page_app_and_core_app/app_lp/log/.keep +0 -0
  159. data/examples/landing_page_app_and_core_app/app_lp/package.json +5 -0
  160. data/examples/landing_page_app_and_core_app/app_lp/public/404.html +67 -0
  161. data/examples/landing_page_app_and_core_app/app_lp/public/422.html +67 -0
  162. data/examples/landing_page_app_and_core_app/app_lp/public/500.html +66 -0
  163. data/examples/landing_page_app_and_core_app/app_lp/public/apple-touch-icon-precomposed.png +0 -0
  164. data/examples/landing_page_app_and_core_app/app_lp/public/apple-touch-icon.png +0 -0
  165. data/examples/landing_page_app_and_core_app/app_lp/public/favicon.ico +0 -0
  166. data/examples/landing_page_app_and_core_app/app_lp/public/robots.txt +1 -0
  167. data/examples/landing_page_app_and_core_app/app_lp/storage/.keep +0 -0
  168. data/examples/landing_page_app_and_core_app/app_lp/test/application_system_test_case.rb +5 -0
  169. data/examples/landing_page_app_and_core_app/app_lp/test/controllers/.keep +0 -0
  170. data/examples/landing_page_app_and_core_app/app_lp/test/fixtures/.keep +0 -0
  171. data/examples/landing_page_app_and_core_app/app_lp/test/fixtures/files/.keep +0 -0
  172. data/examples/landing_page_app_and_core_app/app_lp/test/helpers/.keep +0 -0
  173. data/examples/landing_page_app_and_core_app/app_lp/test/integration/.keep +0 -0
  174. data/examples/landing_page_app_and_core_app/app_lp/test/mailers/.keep +0 -0
  175. data/examples/landing_page_app_and_core_app/app_lp/test/models/.keep +0 -0
  176. data/examples/landing_page_app_and_core_app/app_lp/test/system/.keep +0 -0
  177. data/examples/landing_page_app_and_core_app/app_lp/test/test_helper.rb +10 -0
  178. data/examples/landing_page_app_and_core_app/app_lp/tmp/.keep +0 -0
  179. data/examples/landing_page_app_and_core_app/app_lp/vendor/.keep +0 -0
  180. data/examples/landing_page_app_and_core_app/docker-compose.yml +26 -0
  181. data/lib/big_session.rb +15 -0
  182. data/lib/big_session/faraday.rb +35 -0
  183. data/lib/big_session/rack_middleware.rb +57 -0
  184. data/lib/big_session/session_id.rb +25 -0
  185. data/lib/big_session/version.rb +5 -0
  186. metadata +330 -0
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
+ # Character.create(name: 'Luke', movie: movies.first)
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Remove a potentially pre-existing server.pid for Rails.
5
+ rm -f /app/tmp/pids/server.pid
6
+
7
+ # Then exec the container's main process (what's set as CMD in the Dockerfile).
8
+ exec "$@"
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "app",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
@@ -0,0 +1,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5
+ end
@@ -0,0 +1,10 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require_relative '../config/environment'
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
+ fixtures :all
8
+
9
+ # Add more helper methods to be used by all tests here...
10
+ end
@@ -0,0 +1,26 @@
1
+ version: '3'
2
+ services:
3
+ db:
4
+ image: postgres
5
+ volumes:
6
+ - ./tmp/db:/var/lib/postgresql/data
7
+ app_core:
8
+ build: app_core
9
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
10
+ volumes:
11
+ - ./app_core:/app
12
+ - ./big_session:/mnt/big_session
13
+ ports:
14
+ - "3000:3000"
15
+ depends_on:
16
+ - db
17
+ app_lp:
18
+ build: app_lp
19
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
20
+ volumes:
21
+ - ./app_lp:/app
22
+ - ./big_session:/mnt/big_session
23
+ ports:
24
+ - "3001:3000"
25
+ depends_on:
26
+ - db
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'big_session/version'
4
+ require 'big_session/faraday'
5
+ require 'big_session/rack_middleware'
6
+ require 'big_session/session_id'
7
+
8
+ module BigSession
9
+ class Error < StandardError; end
10
+
11
+ BIG_SESSION_HEADER_NAME = 'X-Bigse-SessionID'
12
+ BIG_SESSION_SIGNATURE_HEADER_NAME = 'X-Bigse-Sig'
13
+ THREAD_BIG_SESSION_ID_KEY = 'big_session_id'
14
+ RAILS_SESSION_BIG_SESSION_ID_KEY = 'big_session_id'
15
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+ require 'openssl'
5
+
6
+ module BigSession
7
+ # This middleware will add BigSession header to request_headers of outgoing
8
+ # connections done by Faraday
9
+ class FaradayBigSession < ::Faraday::Middleware
10
+ class << self
11
+ def activate
12
+ ::Faraday::Middleware.register_middleware big_session: ::BigSession::FaradayBigSession
13
+ end
14
+ end
15
+
16
+ def initialize(app, header_secret = nil)
17
+ @app = app
18
+ @header_secret = header_secret
19
+ end
20
+
21
+ def call(env)
22
+ if SessionId.current
23
+ headers = { ::BigSession::BIG_SESSION_HEADER_NAME => SessionId.current, }
24
+
25
+ if @header_secret
26
+ sig = OpenSSL::HMAC.hexdigest('sha256', @header_secret, SessionId.current)
27
+ headers[::BigSession::BIG_SESSION_SIGNATURE_HEADER_NAME] = sig
28
+ end
29
+
30
+ env[:request_headers].merge!(headers)
31
+ end
32
+ @app.call(env)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+ require 'openssl'
5
+ require 'logger'
6
+
7
+ module BigSession
8
+ # This middleware reads BigSession headers from the request and sets/creates a
9
+ # SessionId usable by the rest of the app
10
+ class RackMiddleware
11
+ class << self
12
+ def activate(header_secret = nil)
13
+ Rails.application.config.middleware.use ::BigSession::RackMiddleware, header_secret
14
+ end
15
+ end
16
+
17
+ def initialize(app, header_secret = nil)
18
+ @app = app
19
+ @header_secret = header_secret
20
+ end
21
+
22
+ def call(env)
23
+ header_session_id, header_signature = env.values_at(
24
+ 'HTTP_' + ::BigSession::BIG_SESSION_HEADER_NAME.upcase.gsub(/-/, '_'),
25
+ 'HTTP_' + ::BigSession::BIG_SESSION_SIGNATURE_HEADER_NAME
26
+ .upcase.gsub(/-/, '_')
27
+ )
28
+
29
+ if header_session_id
30
+ env['rack.session'][::BigSession::RAILS_SESSION_BIG_SESSION_ID_KEY] =
31
+ if @header_secret
32
+ validate_header_session_id(header_session_id, header_signature)
33
+ else
34
+ header_session_id
35
+ end
36
+
37
+ SessionId.set(env['rack.session'][::BigSession::RAILS_SESSION_BIG_SESSION_ID_KEY])
38
+ else
39
+ SessionId.set(env['rack.session'][::BigSession::RAILS_SESSION_BIG_SESSION_ID_KEY]) unless SessionId.current
40
+ env['rack.session'][::BigSession::RAILS_SESSION_BIG_SESSION_ID_KEY] = SessionId.current
41
+ end
42
+
43
+ @app.call(env)
44
+ end
45
+
46
+ private
47
+
48
+ def validate_header_session_id(header_session_id, header_signature)
49
+ digest = OpenSSL::HMAC.hexdigest('sha256', @header_secret, header_session_id)
50
+ return header_session_id if digest == header_signature
51
+
52
+ logger = Logger.new(STDOUT)
53
+ logger.warn('Failed to validate big session header signature.')
54
+ nil
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+
5
+ module BigSession
6
+ # SessionId object bridges an access from users to session id
7
+ class SessionId
8
+ class << self
9
+ def current
10
+ Thread.current[::BigSession::THREAD_BIG_SESSION_ID_KEY]
11
+ end
12
+
13
+ def set(value = nil)
14
+ Thread.current[::BigSession::THREAD_BIG_SESSION_ID_KEY] =
15
+ value || new_session_id
16
+ end
17
+
18
+ def new_session_id
19
+ SecureRandom.hex(16)
20
+ end
21
+ end
22
+
23
+ private_class_method :new_session_id
24
+ end
25
+ end