omniauth-aai 0.5.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +153 -123
  6. data/LICENSE.txt +21 -0
  7. data/README.md +8 -33
  8. data/lib/.DS_Store +0 -0
  9. data/lib/generators/aai/setup_generator.rb +44 -0
  10. data/lib/generators/aai/templates/migration.rb +18 -2
  11. data/lib/generators/aai/templates/omniauth.rb +18 -6
  12. data/lib/generators/aai/templates/session_controller.rb +6 -8
  13. data/lib/generators/aai/templates/user.rb +25 -9
  14. data/lib/omniauth-aai.rb +2 -1
  15. data/lib/omniauth-aai/version.rb +1 -1
  16. data/lib/omniauth/has_current_user.rb +57 -0
  17. data/lib/omniauth/strategies/aai.rb +117 -88
  18. data/omniauth-aai.gemspec +23 -17
  19. data/spec/example_rails3_app/.DS_Store +0 -0
  20. data/spec/{example_rails_app → example_rails3_app}/.gitignore +0 -0
  21. data/spec/{example_rails_app → example_rails3_app}/Gemfile +2 -4
  22. data/spec/example_rails3_app/Gemfile.lock +123 -0
  23. data/spec/{example_rails_app → example_rails3_app}/Rakefile +0 -0
  24. data/spec/{example_rails_app → example_rails3_app}/app/assets/images/rails.png +0 -0
  25. data/spec/{example_rails_app → example_rails3_app}/app/assets/javascripts/application.js +0 -0
  26. data/spec/{example_rails_app → example_rails3_app}/app/assets/javascripts/welcome.js.coffee +0 -0
  27. data/spec/{example_rails_app → example_rails3_app}/app/assets/stylesheets/application.css +0 -0
  28. data/spec/{example_rails_app → example_rails3_app}/app/assets/stylesheets/welcome.css.scss +0 -0
  29. data/spec/{example_rails_app → example_rails3_app}/app/controllers/application_controller.rb +0 -0
  30. data/spec/{example_rails_app → example_rails3_app}/app/controllers/welcome_controller.rb +4 -2
  31. data/spec/{example_rails_app → example_rails3_app}/app/helpers/application_helper.rb +0 -0
  32. data/spec/{example_rails_app → example_rails3_app}/app/helpers/welcome_helper.rb +0 -0
  33. data/spec/{example_rails_app → example_rails3_app}/app/mailers/.gitkeep +0 -0
  34. data/spec/{example_rails_app → example_rails3_app}/app/models/.gitkeep +0 -0
  35. data/spec/example_rails3_app/app/views/.DS_Store +0 -0
  36. data/spec/{example_rails_app → example_rails3_app}/app/views/layouts/application.html.erb +0 -0
  37. data/spec/{example_rails_app → example_rails3_app}/app/views/welcome/index.html.erb +0 -0
  38. data/spec/{example_rails_app → example_rails3_app}/app/views/welcome/protected.html.erb +0 -0
  39. data/spec/{example_rails_app → example_rails3_app}/change_application_controller.rb +0 -0
  40. data/spec/{example_rails_app → example_rails3_app}/config.ru +0 -0
  41. data/spec/{example_rails_app → example_rails3_app}/config/application.rb +1 -6
  42. data/spec/{example_rails_app → example_rails3_app}/config/boot.rb +0 -0
  43. data/spec/{example_rails_app → example_rails3_app}/config/database.yml +0 -0
  44. data/spec/{example_rails_app → example_rails3_app}/config/environment.rb +0 -0
  45. data/spec/{example_rails_app → example_rails3_app}/config/environments/development.rb +1 -6
  46. data/spec/{example_rails_app → example_rails3_app}/config/environments/production.rb +0 -3
  47. data/spec/{example_rails_app → example_rails3_app}/config/environments/test.rb +2 -3
  48. data/spec/{example_rails_app → example_rails3_app}/config/initializers/backtrace_silencers.rb +0 -0
  49. data/spec/{example_rails_app → example_rails3_app}/config/initializers/inflections.rb +0 -0
  50. data/spec/{example_rails_app → example_rails3_app}/config/initializers/mime_types.rb +0 -0
  51. data/spec/{example_rails_app → example_rails3_app}/config/initializers/secret_token.rb +1 -0
  52. data/spec/{example_rails_app → example_rails3_app}/config/initializers/session_store.rb +0 -0
  53. data/spec/{example_rails_app → example_rails3_app}/config/initializers/wrap_parameters.rb +0 -0
  54. data/spec/{example_rails_app → example_rails3_app}/config/locales/en.yml +0 -0
  55. data/spec/{example_rails_app → example_rails3_app}/config/routes.rb +2 -2
  56. data/spec/example_rails3_app/db/development.sqlite3 +0 -0
  57. data/spec/example_rails3_app/db/schema.rb +16 -0
  58. data/spec/{example_rails_app → example_rails3_app}/db/seeds.rb +0 -0
  59. data/spec/example_rails3_app/db/test.sqlite3 +0 -0
  60. data/spec/{example_rails_app → example_rails3_app}/doc/README_FOR_APP +0 -0
  61. data/spec/{example_rails_app → example_rails3_app}/lib/assets/.gitkeep +0 -0
  62. data/spec/{example_rails_app → example_rails3_app}/lib/tasks/.gitkeep +0 -0
  63. data/spec/{example_rails_app → example_rails3_app}/log/.gitkeep +0 -0
  64. data/spec/example_rails3_app/log/development.log +741 -0
  65. data/spec/example_rails3_app/log/test.log +24 -0
  66. data/spec/{example_rails_app → example_rails3_app}/public/404.html +0 -0
  67. data/spec/{example_rails_app → example_rails3_app}/public/422.html +0 -0
  68. data/spec/{example_rails_app → example_rails3_app}/public/500.html +0 -0
  69. data/spec/{example_rails_app → example_rails3_app}/public/favicon.ico +0 -0
  70. data/spec/{example_rails_app → example_rails3_app}/public/robots.txt +0 -0
  71. data/spec/{example_rails_app → example_rails3_app}/script/rails +0 -0
  72. data/spec/{example_rails_app → example_rails3_app}/test/fixtures/.gitkeep +0 -0
  73. data/spec/{example_rails_app → example_rails3_app}/test/functional/.gitkeep +0 -0
  74. data/spec/{example_rails_app → example_rails3_app}/test/functional/welcome_controller_test.rb +0 -0
  75. data/spec/{example_rails_app → example_rails3_app}/test/integration/.gitkeep +0 -0
  76. data/spec/{example_rails_app → example_rails3_app}/test/performance/browsing_test.rb +0 -0
  77. data/spec/{example_rails_app → example_rails3_app}/test/test_helper.rb +0 -0
  78. data/spec/{example_rails_app → example_rails3_app}/test/unit/.gitkeep +0 -0
  79. data/spec/{example_rails_app → example_rails3_app}/test/unit/helpers/welcome_helper_test.rb +0 -0
  80. data/spec/example_rails3_app/tmp/cache/assets/C26/690/sprockets%2F93708cb34051f3000884905e8669d74a +0 -0
  81. data/spec/example_rails3_app/tmp/cache/assets/C30/B40/sprockets%2Ff006fa583c943775b96596827195b022 +0 -0
  82. data/spec/example_rails3_app/tmp/cache/assets/C5C/B50/sprockets%2F7a556208881f6d893d11269bf2a09158 +0 -0
  83. data/spec/example_rails3_app/tmp/cache/assets/C83/640/sprockets%2F3233432f81669b9bd10ef726c526d348 +0 -0
  84. data/spec/example_rails3_app/tmp/cache/assets/CD0/AB0/sprockets%2F2211190fb757d05874e2b25fc37a31ad +0 -0
  85. data/spec/example_rails3_app/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  86. data/spec/example_rails3_app/tmp/cache/assets/CE2/AD0/sprockets%2Fbd71546009ab5e606b3f27b4c6a79856 +0 -0
  87. data/spec/example_rails3_app/tmp/cache/assets/D14/000/sprockets%2Fffd7643b7c429e23bdb2281097a5e096 +0 -0
  88. data/spec/example_rails3_app/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  89. data/spec/example_rails3_app/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  90. data/spec/example_rails3_app/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  91. data/spec/example_rails3_app/tmp/cache/assets/D5E/170/sprockets%2F2f2229c70dcf195564d4d0fd6a12ac1a +0 -0
  92. data/spec/example_rails3_app/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  93. data/spec/example_rails3_app/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  94. data/spec/example_rails3_app/tmp/cache/assets/E29/9D0/sprockets%2Fea5ba88ffb1f831008ba38ed70bd8cfa +0 -0
  95. data/spec/example_rails3_app/tmp/cache/assets/E3F/0C0/sprockets%2F9addc9febe49c19a6eee9360f156afe3 +0 -0
  96. data/spec/{example_rails_app → example_rails3_app}/vendor/assets/javascripts/.gitkeep +0 -0
  97. data/spec/{example_rails_app → example_rails3_app}/vendor/assets/stylesheets/.gitkeep +0 -0
  98. data/spec/{example_rails_app → example_rails3_app}/vendor/plugins/.gitkeep +0 -0
  99. data/spec/example_rails4_app/.gitignore +17 -0
  100. data/spec/example_rails4_app/Gemfile +46 -0
  101. data/spec/example_rails4_app/Gemfile.lock +171 -0
  102. data/spec/example_rails4_app/README.rdoc +28 -0
  103. data/spec/example_rails4_app/Rakefile +6 -0
  104. data/spec/example_rails4_app/app/assets/images/.keep +0 -0
  105. data/spec/example_rails4_app/app/assets/javascripts/application.js +16 -0
  106. data/spec/example_rails4_app/app/assets/stylesheets/application.css +15 -0
  107. data/spec/example_rails4_app/app/controllers/application_controller.rb +4 -0
  108. data/spec/example_rails4_app/app/controllers/concerns/.keep +0 -0
  109. data/spec/example_rails4_app/app/controllers/session_controller.rb +38 -0
  110. data/spec/example_rails4_app/app/controllers/welcome_controller.rb +11 -0
  111. data/spec/example_rails4_app/app/helpers/application_helper.rb +2 -0
  112. data/spec/example_rails4_app/app/mailers/.keep +0 -0
  113. data/spec/example_rails4_app/app/models/.keep +0 -0
  114. data/spec/example_rails4_app/app/models/concerns/.keep +0 -0
  115. data/spec/example_rails4_app/app/models/user.rb +57 -0
  116. data/spec/example_rails4_app/app/views/.DS_Store +0 -0
  117. data/spec/example_rails4_app/app/views/layouts/application.html.erb +14 -0
  118. data/spec/example_rails4_app/app/views/welcome/index.html.erb +3 -0
  119. data/spec/example_rails4_app/app/views/welcome/protected.html.erb +2 -0
  120. data/spec/example_rails4_app/bin/bundle +3 -0
  121. data/spec/example_rails4_app/bin/rails +8 -0
  122. data/spec/example_rails4_app/bin/rake +8 -0
  123. data/spec/example_rails4_app/bin/setup +29 -0
  124. data/spec/example_rails4_app/bin/spring +15 -0
  125. data/spec/example_rails4_app/config.ru +4 -0
  126. data/spec/example_rails4_app/config/application.rb +26 -0
  127. data/spec/example_rails4_app/config/boot.rb +3 -0
  128. data/spec/example_rails4_app/config/database.yml +25 -0
  129. data/spec/example_rails4_app/config/environment.rb +5 -0
  130. data/spec/example_rails4_app/config/environments/development.rb +41 -0
  131. data/spec/example_rails4_app/config/environments/production.rb +79 -0
  132. data/spec/example_rails4_app/config/environments/test.rb +42 -0
  133. data/spec/example_rails4_app/config/initializers/assets.rb +11 -0
  134. data/spec/example_rails4_app/config/initializers/backtrace_silencers.rb +7 -0
  135. data/spec/example_rails4_app/config/initializers/cookies_serializer.rb +3 -0
  136. data/spec/example_rails4_app/config/initializers/filter_parameter_logging.rb +4 -0
  137. data/spec/example_rails4_app/config/initializers/inflections.rb +16 -0
  138. data/spec/example_rails4_app/config/initializers/mime_types.rb +4 -0
  139. data/spec/example_rails4_app/config/initializers/omniauth.rb +23 -0
  140. data/spec/example_rails4_app/config/initializers/session_store.rb +3 -0
  141. data/spec/example_rails4_app/config/initializers/wrap_parameters.rb +14 -0
  142. data/spec/example_rails4_app/config/locales/en.yml +23 -0
  143. data/spec/example_rails4_app/config/routes.rb +10 -0
  144. data/spec/example_rails4_app/config/secrets.yml +22 -0
  145. data/spec/example_rails4_app/db/development.sqlite3 +0 -0
  146. data/spec/example_rails4_app/db/migrate/20150528142303_aai_create_user.rb +20 -0
  147. data/spec/example_rails4_app/db/migrate/20150609094544_create_aai_user.rb +26 -0
  148. data/spec/example_rails4_app/db/schema.rb +33 -0
  149. data/spec/example_rails4_app/db/seeds.rb +7 -0
  150. data/spec/example_rails4_app/lib/assets/.keep +0 -0
  151. data/spec/example_rails4_app/lib/tasks/.keep +0 -0
  152. data/spec/example_rails4_app/log/.keep +0 -0
  153. data/spec/example_rails4_app/log/development.log +7189 -0
  154. data/spec/example_rails4_app/log/test.log +0 -0
  155. data/spec/example_rails4_app/public/404.html +67 -0
  156. data/spec/example_rails4_app/public/422.html +67 -0
  157. data/spec/example_rails4_app/public/500.html +66 -0
  158. data/spec/example_rails4_app/public/favicon.ico +0 -0
  159. data/spec/example_rails4_app/public/robots.txt +5 -0
  160. data/spec/example_rails4_app/test/controllers/.keep +0 -0
  161. data/spec/example_rails4_app/test/fixtures/.keep +0 -0
  162. data/spec/example_rails4_app/test/helpers/.keep +0 -0
  163. data/spec/example_rails4_app/test/integration/.keep +0 -0
  164. data/spec/example_rails4_app/test/mailers/.keep +0 -0
  165. data/spec/example_rails4_app/test/models/.keep +0 -0
  166. data/spec/example_rails4_app/test/test_helper.rb +10 -0
  167. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/1s_XCxu5Ta3ZrQVnXIYvLyRMXFQo20cDx9dOl2Z2iF8.cache +1 -0
  168. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/29DyBLYZiyJ3FlvLIMPsG2-7J8nAW42idLjWLEVdB_k.cache +0 -0
  169. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/3QbXCZJvxomnkCnjUWHuRcr1GygZ_h2BHAvxwpDe8_s.cache +1 -0
  170. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/4DpD3QisvkI9coAiaW5J81R3QEdauKikO3Gh5M8mwWo.cache +1 -0
  171. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/6NLgJvQ8d_2Hvs_dsIe78tpsALlFUB02E_yBe-2E5cA.cache +0 -0
  172. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/6jHw85RU0ldd0Q9aN-7rANpT7g1-koNDbSenv-m7smI.cache +1 -0
  173. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/7BAbDbQvvxI5tyXDU4FFEVqkskvwpwBb-Okv_3k7m_A.cache +0 -0
  174. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/9wp0IZ0iih5-OpulhDQiwTcivSJ1B0NGGT3E0QqfUvY.cache +1 -0
  175. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/BNSnmei4pmTUWNUSAxEsb0MthlP4aMS69DOMLpxnO1w.cache +0 -0
  176. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/CuDbyYCWFI80xf5TcM_YGo4vs7XDrDT2uGZbXL1CNlU.cache +1 -0
  177. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/E7vUl62-SGsQ8YapPcF158Pt1JkBL-9rifcB_9dP8Dk.cache +1 -0
  178. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/Gb8DbxW8LZBtcLvB3DaLNTXt5D0MNezSV797OaoPY9Q.cache +1 -0
  179. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/GgQIx53L-9pWadlFfRd5NlAqwNFKf7DLPkPnsnQ7bNk.cache +1 -0
  180. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/GjsYHKbT8fxMeVlnpmarx6Xi-_Ph0QMuk1BHoU4JDrQ.cache +2 -0
  181. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/H4FEyyRC4IJsChOdu1cf9NDgg8w6J1YBVNHaKN92h9o.cache +0 -0
  182. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/If5Lvqrq1tySO8vBUqp2xvRY_mnDfGebBxBP2mxZbZY.cache +0 -0
  183. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/IoT_x37i_0kSKYgLgbJR5-i6lvuoyNhOt9FSw-yILiQ.cache +0 -0
  184. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/JUseOAL-WHjhDijGjAaXwOvZEJUVhMs_jFSMbXunViY.cache +1 -0
  185. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/KJcDzapXqjQsiil8Z8og8g_9qX88kXR8p3pMopsauA8.cache +1 -0
  186. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/KZpDQ14WKjcnWnLxlL99qFCd6ARfk0MsdegUfI30RMk.cache +1 -0
  187. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/KZxCQPT4Q2wX3rHnJZcFGWZPTtq7oNH9llxBAALh43s.cache +1 -0
  188. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/LgV_5lRim8CeylWertau64VwyRxtI51id8BtgIok58g.cache +1 -0
  189. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/Nt-6pBlTra27ZPWSp2yTZSKBAePHJHgDlIoxWTgF9i8.cache +1 -0
  190. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/PHhC5vQizTPXEkJAiD_q9ESL7UlJW-l8Ua2aoWOhv_o.cache +0 -0
  191. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/QRU43JksZxXfCsqux8aCe2yyWueGiamUDi18N8gDA1Q.cache +1 -0
  192. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/RECBJfTHjk7obOczR_QxMkSagYRkmidf_ZawDoZTR8A.cache +1 -0
  193. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/RanHbvC55zjJip0GoEuKsXCXGiMAnd9n7zr67BIqBSw.cache +1 -0
  194. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/S5179qXMIYo2z-pYHnXOtD2IYoz5ac8moYSK7pNt7m8.cache +2 -0
  195. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/SO9WJ6f1sF18HRfzSmwkLdVZZwRBNz1DxAaYtGbOTrE.cache +1 -0
  196. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/SPlj-pwirc-AB3GMeOqDR5gSAiu3j6C7QnAZfGmE9_I.cache +0 -0
  197. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/TGEldewczDNL-pNPKYkePKZe3ySFo2sisfkbnD19W4s.cache +2 -0
  198. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/TdlxPZJxUr_7HWj7CrC81yJyV0-40_Ogqo_1NTaEoIU.cache +1 -0
  199. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/TowmqkMiUGEwvy7lnHQ_88ROBl0yb2D4yH0ugiNjvfA.cache +1 -0
  200. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/Tp7wu_U3u6gFUnDoUHA40bWXyFOSSxNiXK6XPRwYmYU.cache +1 -0
  201. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/TqgWeb7o7Z23teWSLaSdF-f3_8aYzRVbBVZhQUHuZVc.cache +1 -0
  202. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/VOp0pIv_pTt1jyD5JQn5Ee721CyQFQTGdnz4ODw38i4.cache +0 -0
  203. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/W8O66kikznV0XXIhsnH-3dHWm24NyxyK2BbzZvEssto.cache +0 -0
  204. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/YLGfTegl3aFlYlDF7dfyQ5OuL6B6D3l-mcGVqtWnVQ8.cache +1 -0
  205. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/YngNHAn-McYDpn3H2vj5Cfs7jvy6y0xXgV2lm-QqytU.cache +0 -0
  206. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/_J-JFAM5KZ8G3xUcVV9ht5vdsdH3wHg737JhiRTNl30.cache +1 -0
  207. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/apXOQCHHr7toaELV0vOhGpGHp0qsm15GmPpb-6SA6GI.cache +0 -0
  208. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/c5jVOyypWys4L2Hoyc4U84gCAJg3tGepalH4_wvPjag.cache +1 -0
  209. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/c8Xfpa8RSionpn-Hbvc5pDqvktT2tZDhvRCrUD1V_Oo.cache +1 -0
  210. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/cihMJr_YPzjx-OxZT97hhVuVpY1rkTjbZmXFd8XHCaU.cache +3 -0
  211. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/dHMPXPs1sOQ-fiWIOHBlX15A53Jm0CIPz2F_hNdtS3M.cache +1 -0
  212. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/e99bn4nHgVDcocbTGKcEmDNK9c_hXbgX6QjCJFCZHJM.cache +0 -0
  213. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/fLv1zUMqDQeVn2AWONn1mWotZV-MKGL2VWCOWalnPkg.cache +0 -0
  214. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/fWQJziLu4L1W29En3opeg-1CsjRQBWmvxu9pCs4bXj8.cache +1 -0
  215. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/gLKErIDcQk5SB5QrsCeFTLyCw5500orRLwYeVdZdKMc.cache +1 -0
  216. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/gr63R85vyTqHHJZQ-17HzBTVQzxNIG5ioLBJIG7ylUI.cache +0 -0
  217. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/h94CfaFE7uxKkjg9ok-t1VaNrmPtIlflckdFHhn8HQs.cache +0 -0
  218. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/hE4vknoiDD4JODeZCrqVQJsqIprogjXMLmC8OwA_Jr0.cache +1 -0
  219. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/hS0tOwqtQJaZQ94vExFzOIkbAuInPL-qbhJ_ehyAIdA.cache +0 -0
  220. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/jRTlxo8OfNbF2UFI9yARZfikVm2L6tckGljgpdPKJAE.cache +0 -0
  221. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/jWzKY7vp1V-gp2DIoaBUf6FHlXy64u51evJE2HTEmHw.cache +1 -0
  222. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/qzBkjnl32lQWbp5TzPSAUL1ai7Di46nMpBx4F7m6x5s.cache +1 -0
  223. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/r77JGKq0Pw_xiSzw2prNjqaAF6alyTiTyCsdnbipthY.cache +0 -0
  224. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/rJ0exYcGrKT54S-78fIu6vNCgQs3mDufsDxQ14gI_8E.cache +0 -0
  225. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/rx80cSLfrwi0ZB09RMu0y303mn2cqY0n-HVvX4OZSvg.cache +1 -0
  226. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/t86ZINxINr8OvlNbaSMwdIJCEKNwBO6brBig2BlQM14.cache +0 -0
  227. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/tXvI8895yJKqfChNv65cTiwS7lytvZHFz1fXzFbzVeM.cache +1 -0
  228. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/ueBgJWdtY_h7B_DpJgfhaB1zK-p3TTKWfXHuoog1ee0.cache +1 -0
  229. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/umu0vtYbA7uPY--szPF2GZOzRsafL6YLGkxCLx52t0c.cache +3 -0
  230. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/wRYMTVh2J03EQY8OmShoXFHM5q_wkCsogrHuAv8CR6g.cache +1 -0
  231. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/xSK_JYmeNOLhG9YlWG_YGYarb8YLyIeMXHahwRIyhZY.cache +0 -0
  232. data/spec/example_rails4_app/tmp/cache/assets/development/sprockets/v3.0/yLpEexUzUtWqrKQPCErdaCnJUUkxgSLIOShi9XNRKlM.cache +0 -0
  233. data/spec/example_rails4_app/vendor/assets/javascripts/.keep +0 -0
  234. data/spec/example_rails4_app/vendor/assets/stylesheets/.keep +0 -0
  235. data/spec/omniauth/has_current_user_spec.rb +9 -0
  236. data/spec/omniauth/strategies/aai_spec.rb +83 -20
  237. data/spec/omniauth/strategies/brute_force_spec.rb +6 -6
  238. data/spec/spec_helper.rb +12 -6
  239. data/spec/support/omniauth_macros.rb +13 -0
  240. metadata +486 -195
  241. data/lib/action_controller/has_current_user.rb +0 -44
  242. data/lib/generators/aai/install_generator.rb +0 -41
  243. data/omniauth-aai-0.3.gem +0 -0
  244. data/omniauth-aai-0.4.gem +0 -0
  245. data/omniauth-aai-0.5.1.gem +0 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d22d4b8df0fc1f34dc64d446f0735c21cca72bfa
4
+ data.tar.gz: 9b68f745e51c2ae6b48b07c23823ce09324043fe
5
+ SHA512:
6
+ metadata.gz: 3af83ad31bc412d7ab19bd1db0340d612152780227919626b4606742684e8c0d296bc1d2342e9694f73f7716270e9e5b4f3bc89b7b8172efa9f925df4cbe76be
7
+ data.tar.gz: 362cb866458401dea78518ff08e0b538f040223ece42757cbade3b97053c072eb56fbe31f3a156177abe513d2be3eb6a2dfdef270e65fd684a14dfb99e6e29a2
data/.DS_Store ADDED
Binary file
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'omniauth-shibboleth', :git => "git://github.com/switch-ch/omniauth-shibboleth.git"
3
+ gem 'omniauth-shibboleth', git: "git://github.com/switch-ch/omniauth-shibboleth.git"
4
4
 
5
5
  gemspec
6
6
 
data/Gemfile.lock CHANGED
@@ -1,147 +1,174 @@
1
1
  GIT
2
2
  remote: git://github.com/switch-ch/omniauth-shibboleth.git
3
- revision: ea3922a8ee98b7a892f26440b8e37bd3ec3fc03d
3
+ revision: 84b9264cdfda3ff724a951647892fdf91427de5c
4
4
  specs:
5
- omniauth-shibboleth (1.0.6)
5
+ omniauth-shibboleth (1.2.0)
6
6
  omniauth (>= 1.0.0)
7
7
 
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- omniauth-aai (0.5.2)
11
+ omniauth-aai (0.6.2)
12
12
  omniauth-shibboleth
13
13
 
14
14
  GEM
15
15
  remote: http://rubygems.org/
16
16
  specs:
17
- actionmailer (3.2.9)
18
- actionpack (= 3.2.9)
19
- mail (~> 2.4.4)
20
- actionpack (3.2.9)
21
- activemodel (= 3.2.9)
22
- activesupport (= 3.2.9)
23
- builder (~> 3.0.0)
17
+ actionmailer (4.2.1)
18
+ actionpack (= 4.2.1)
19
+ actionview (= 4.2.1)
20
+ activejob (= 4.2.1)
21
+ mail (~> 2.5, >= 2.5.4)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ actionpack (4.2.1)
24
+ actionview (= 4.2.1)
25
+ activesupport (= 4.2.1)
26
+ rack (~> 1.6)
27
+ rack-test (~> 0.6.2)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
30
+ actionview (4.2.1)
31
+ activesupport (= 4.2.1)
32
+ builder (~> 3.1)
24
33
  erubis (~> 2.7.0)
25
- journey (~> 1.0.4)
26
- rack (~> 1.4.0)
27
- rack-cache (~> 1.2)
28
- rack-test (~> 0.6.1)
29
- sprockets (~> 2.2.1)
30
- activemodel (3.2.9)
31
- activesupport (= 3.2.9)
32
- builder (~> 3.0.0)
33
- activerecord (3.2.9)
34
- activemodel (= 3.2.9)
35
- activesupport (= 3.2.9)
36
- arel (~> 3.0.2)
37
- tzinfo (~> 0.3.29)
38
- activeresource (3.2.9)
39
- activemodel (= 3.2.9)
40
- activesupport (= 3.2.9)
41
- activesupport (3.2.9)
42
- i18n (~> 0.6)
43
- multi_json (~> 1.0)
44
- arel (3.0.2)
45
- builder (3.0.4)
46
- capybara (2.0.1)
34
+ rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
36
+ activejob (4.2.1)
37
+ activesupport (= 4.2.1)
38
+ globalid (>= 0.3.0)
39
+ activemodel (4.2.1)
40
+ activesupport (= 4.2.1)
41
+ builder (~> 3.1)
42
+ activerecord (4.2.1)
43
+ activemodel (= 4.2.1)
44
+ activesupport (= 4.2.1)
45
+ arel (~> 6.0)
46
+ activesupport (4.2.1)
47
+ i18n (~> 0.7)
48
+ json (~> 1.7, >= 1.7.7)
49
+ minitest (~> 5.1)
50
+ thread_safe (~> 0.3, >= 0.3.4)
51
+ tzinfo (~> 1.1)
52
+ arel (6.0.0)
53
+ builder (3.2.2)
54
+ capybara (2.4.4)
47
55
  mime-types (>= 1.16)
48
56
  nokogiri (>= 1.3.3)
49
57
  rack (>= 1.0.0)
50
58
  rack-test (>= 0.5.4)
51
- selenium-webdriver (~> 2.0)
52
- xpath (~> 1.0.0)
53
- childprocess (0.3.6)
54
- ffi (~> 1.0, >= 1.0.6)
55
- coderay (1.0.8)
56
- diff-lcs (1.1.3)
59
+ xpath (~> 2.0)
60
+ celluloid (0.16.0)
61
+ timers (~> 4.0.0)
62
+ coderay (1.1.0)
63
+ diff-lcs (1.2.5)
57
64
  erubis (2.7.0)
58
- ffi (1.2.0)
59
- guard (1.5.4)
60
- listen (>= 0.4.2)
61
- lumberjack (>= 1.0.2)
62
- pry (>= 0.9.10)
63
- thor (>= 0.14.6)
64
- guard-rspec (2.2.0)
65
- guard (>= 1.1)
66
- rspec (~> 2.11)
67
- hashie (1.2.0)
68
- hike (1.2.1)
69
- i18n (0.6.1)
70
- journey (1.0.4)
71
- json (1.7.5)
72
- libwebsocket (0.1.6.1)
73
- websocket
74
- listen (0.6.0)
75
- lumberjack (1.0.2)
76
- mail (2.4.4)
77
- i18n (>= 0.4.0)
78
- mime-types (~> 1.16)
79
- treetop (~> 1.4.8)
80
- method_source (0.8.1)
81
- mime-types (1.19)
82
- multi_json (1.3.7)
83
- nokogiri (1.5.5)
84
- omniauth (1.1.1)
85
- hashie (~> 1.2)
86
- rack
87
- polyglot (0.3.3)
88
- pry (0.9.10)
89
- coderay (~> 1.0.5)
90
- method_source (~> 0.8)
91
- slop (~> 3.3.1)
92
- rack (1.4.1)
93
- rack-cache (1.2)
94
- rack (>= 0.4)
95
- rack-ssl (1.3.2)
96
- rack
97
- rack-test (0.6.2)
65
+ ffi (1.9.8)
66
+ formatador (0.2.5)
67
+ globalid (0.3.5)
68
+ activesupport (>= 4.1.0)
69
+ guard (2.12.5)
70
+ formatador (>= 0.2.4)
71
+ listen (~> 2.7)
72
+ lumberjack (~> 1.0)
73
+ nenv (~> 0.1)
74
+ notiffany (~> 0.0)
75
+ pry (>= 0.9.12)
76
+ shellany (~> 0.0)
77
+ thor (>= 0.18.1)
78
+ guard-compat (1.2.1)
79
+ guard-rspec (4.5.1)
80
+ guard (~> 2.1)
81
+ guard-compat (~> 1.1)
82
+ rspec (>= 2.99.0, < 4.0)
83
+ hashie (3.4.1)
84
+ hitimes (1.2.2)
85
+ i18n (0.7.0)
86
+ json (1.8.3)
87
+ listen (2.10.0)
88
+ celluloid (~> 0.16.0)
89
+ rb-fsevent (>= 0.9.3)
90
+ rb-inotify (>= 0.9)
91
+ loofah (2.0.2)
92
+ nokogiri (>= 1.5.9)
93
+ lumberjack (1.0.9)
94
+ mail (2.6.3)
95
+ mime-types (>= 1.16, < 3)
96
+ method_source (0.8.2)
97
+ mime-types (2.6.1)
98
+ mini_portile (0.6.2)
99
+ minitest (5.7.0)
100
+ nenv (0.2.0)
101
+ nokogiri (1.6.6.2)
102
+ mini_portile (~> 0.6.0)
103
+ notiffany (0.0.6)
104
+ nenv (~> 0.1)
105
+ shellany (~> 0.0)
106
+ omniauth (1.2.2)
107
+ hashie (>= 1.2, < 4)
108
+ rack (~> 1.0)
109
+ pry (0.10.1)
110
+ coderay (~> 1.1.0)
111
+ method_source (~> 0.8.1)
112
+ slop (~> 3.4)
113
+ rack (1.6.1)
114
+ rack-test (0.6.3)
98
115
  rack (>= 1.0)
99
- rails (3.2.9)
100
- actionmailer (= 3.2.9)
101
- actionpack (= 3.2.9)
102
- activerecord (= 3.2.9)
103
- activeresource (= 3.2.9)
104
- activesupport (= 3.2.9)
105
- bundler (~> 1.0)
106
- railties (= 3.2.9)
107
- railties (3.2.9)
108
- actionpack (= 3.2.9)
109
- activesupport (= 3.2.9)
110
- rack-ssl (~> 1.3.2)
116
+ rails (4.2.1)
117
+ actionmailer (= 4.2.1)
118
+ actionpack (= 4.2.1)
119
+ actionview (= 4.2.1)
120
+ activejob (= 4.2.1)
121
+ activemodel (= 4.2.1)
122
+ activerecord (= 4.2.1)
123
+ activesupport (= 4.2.1)
124
+ bundler (>= 1.3.0, < 2.0)
125
+ railties (= 4.2.1)
126
+ sprockets-rails
127
+ rails-deprecated_sanitizer (1.0.3)
128
+ activesupport (>= 4.2.0.alpha)
129
+ rails-dom-testing (1.0.6)
130
+ activesupport (>= 4.2.0.beta, < 5.0)
131
+ nokogiri (~> 1.6.0)
132
+ rails-deprecated_sanitizer (>= 1.0.1)
133
+ rails-html-sanitizer (1.0.2)
134
+ loofah (~> 2.0)
135
+ railties (4.2.1)
136
+ actionpack (= 4.2.1)
137
+ activesupport (= 4.2.1)
111
138
  rake (>= 0.8.7)
112
- rdoc (~> 3.4)
113
- thor (>= 0.14.6, < 2.0)
114
- rake (10.0.2)
115
- rdoc (3.12)
116
- json (~> 1.4)
117
- rspec (2.12.0)
118
- rspec-core (~> 2.12.0)
119
- rspec-expectations (~> 2.12.0)
120
- rspec-mocks (~> 2.12.0)
121
- rspec-core (2.12.0)
122
- rspec-expectations (2.12.0)
123
- diff-lcs (~> 1.1.3)
124
- rspec-mocks (2.12.0)
125
- rubyzip (0.9.9)
126
- selenium-webdriver (2.26.0)
127
- childprocess (>= 0.2.5)
128
- libwebsocket (~> 0.1.3)
129
- multi_json (~> 1.0)
130
- rubyzip
131
- slop (3.3.3)
132
- sprockets (2.2.1)
133
- hike (~> 1.2)
134
- multi_json (~> 1.0)
139
+ thor (>= 0.18.1, < 2.0)
140
+ rake (10.4.2)
141
+ rb-fsevent (0.9.5)
142
+ rb-inotify (0.9.5)
143
+ ffi (>= 0.5.0)
144
+ rspec (3.2.0)
145
+ rspec-core (~> 3.2.0)
146
+ rspec-expectations (~> 3.2.0)
147
+ rspec-mocks (~> 3.2.0)
148
+ rspec-core (3.2.3)
149
+ rspec-support (~> 3.2.0)
150
+ rspec-expectations (3.2.1)
151
+ diff-lcs (>= 1.2.0, < 2.0)
152
+ rspec-support (~> 3.2.0)
153
+ rspec-mocks (3.2.1)
154
+ diff-lcs (>= 1.2.0, < 2.0)
155
+ rspec-support (~> 3.2.0)
156
+ rspec-support (3.2.2)
157
+ shellany (0.0.1)
158
+ slop (3.6.0)
159
+ sprockets (3.1.0)
135
160
  rack (~> 1.0)
136
- tilt (~> 1.1, != 1.3.0)
137
- thor (0.16.0)
138
- tilt (1.3.3)
139
- treetop (1.4.12)
140
- polyglot
141
- polyglot (>= 0.3.1)
142
- tzinfo (0.3.35)
143
- websocket (1.0.4)
144
- xpath (1.0.0)
161
+ sprockets-rails (2.3.1)
162
+ actionpack (>= 3.0)
163
+ activesupport (>= 3.0)
164
+ sprockets (>= 2.8, < 4.0)
165
+ thor (0.19.1)
166
+ thread_safe (0.3.5)
167
+ timers (4.0.1)
168
+ hitimes
169
+ tzinfo (1.2.2)
170
+ thread_safe (~> 0.1)
171
+ xpath (2.0.0)
145
172
  nokogiri (~> 1.3)
146
173
 
147
174
  PLATFORMS
@@ -155,4 +182,7 @@ DEPENDENCIES
155
182
  rack-test
156
183
  rails
157
184
  rake
158
- rspec (~> 2.8)
185
+ rspec (~> 3.2)
186
+
187
+ BUNDLED WITH
188
+ 1.10.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 SWITCH, Zurich
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -19,16 +19,14 @@ Install as a gem via Gemfile or with
19
19
 
20
20
  ### Generator
21
21
 
22
- rails generate aai:install
22
+ rails generate aai:setup
23
23
 
24
24
  This will generate some basic authenthication objects for rails:
25
25
 
26
- * config/omniauth.rb
26
+ * config/initializers/omniauth.rb
27
27
  * app/controller/session_controller.rb
28
28
  * app/models/user.rb
29
- * db/migrate/create_users_adapt_and_copy_to_migration.rb
30
-
31
- You'll need to configure at least the 'db/migrate/create_users_adapt_and_copy_to_migration.rb' file. Just run 'rails g migration createUsersTable' copy the content of 'create_users_adapt_and_copy_to_migration.rb' and delete it.
29
+ * db/migrate/create_aai_user.rb
32
30
 
33
31
  You can run it with '--persist false' if you don't want to persist the user to the local db.
34
32
 
@@ -50,7 +48,7 @@ By default, you will get all the standard SWITCHaai values, or you can configure
50
48
  Rails.application.config.middleware.use OmniAuth::Builder do
51
49
  provider :aai,{
52
50
  :uid_field => :'persistent-id',
53
- :fields => [:name, :email, :swiss_ep_uid],
51
+ :fields => [:name, :email, :unique_id],
54
52
  :extra_fields => [:'Shib-Authentication-Instant']# See lib/omniauth/strategies/aai.rb for full list.
55
53
  }
56
54
  ```
@@ -74,9 +72,9 @@ In development/local mode or in cases where you don't have a SWITCHaai Service P
74
72
  Rails.application.config.middleware.use OmniAuth::Builder do
75
73
  if Rails.env.development?
76
74
  provider :developer, {
77
- :uid_field => :'persistent-id',
78
- :fields => OmniAuth::Strategies::Aai::DEFAULT_FIELDS,
79
- :extra_fields => OmniAuth::Strategies::Aai::DEFAULT_EXTRA_FIELDS
75
+ uid_field: :'persistent-id',
76
+ fields: [:name, :email, :persistent_id, :unique_id],
77
+ extra_fields: OmniAuth::Strategies::Aai::DEFAULT_EXTRA_FIELDS
80
78
  }
81
79
  end
82
80
  end
@@ -95,7 +93,7 @@ When you deploy a new application, you may want to confirm the assumed attribute
95
93
 
96
94
  ### Current User
97
95
 
98
- If you want to use the build in User object and the 'current_user' functionality, you can use the magic call 'has_current_user'
96
+ If you want to use the build in User object and the 'current_user' functionality, you can include the has_current_user method to concerned ActionController or the ApplicationController if you want to have the functionality available globally.
99
97
 
100
98
  ```ruby
101
99
  class ApplicationController < ActionController::Base
@@ -103,26 +101,3 @@ If you want to use the build in User object and the 'current_user' functionality
103
101
  has_current_user
104
102
  end
105
103
  ```
106
-
107
-
108
- ## License (MIT License)
109
-
110
- Copyright (C) SWITCH, Zurich, original copyright (omniauth-shibboleth) 2011 by Toyokazu Akiyama.
111
-
112
- Permission is hereby granted, free of charge, to any person obtaining a copy
113
- of this software and associated documentation files (the "Software"), to deal
114
- in the Software without restriction, including without limitation the rights
115
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
116
- copies of the Software, and to permit persons to whom the Software is
117
- furnished to do so, subject to the following conditions:
118
-
119
- The above copyright notice and this permission notice shall be included in
120
- all copies or substantial portions of the Software.
121
-
122
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
123
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
124
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
125
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
126
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
127
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
128
- THE SOFTWARE.
data/lib/.DS_Store ADDED
Binary file
@@ -0,0 +1,44 @@
1
+ module Aai
2
+ class SetupGenerator < Rails::Generators::Base
3
+ include Rails::Generators::Migration
4
+
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ desc "Generate Config Files / User / Session and Routes"
8
+
9
+ class_option :persist, type: :boolean, default: true, desc: "Set to false if you don't want persistent User"
10
+
11
+ # def self.source_root
12
+ # @source_root ||= File.join(File.dirname(__FILE__), 'templates')
13
+ # end
14
+
15
+ def copy_initializer_file
16
+ copy_file "omniauth.rb", "config/initializers/omniauth.rb"
17
+ end
18
+
19
+ def copy_session_controller_file
20
+ if true
21
+ copy_file "session_controller.rb", "app/controllers/session_controller.rb"
22
+ inject_into_class "app/controllers/application_controller.rb", ApplicationController, " has_current_user\n"
23
+ route("post '/auth/:provider/callback', to: 'session#create', as: 'auth_callback'")
24
+ route("get '/auth/failure', to: 'session#failure', as: 'auth_failure'")
25
+ route("get '/auth/logout', to: 'session#destroy', as: 'logout'")
26
+ end
27
+ end
28
+
29
+ def copy_user_file
30
+ template "user.rb", "app/models/user.rb"
31
+ migration_template "migration.rb", "db/migrate/create_aai_user.rb" if options[:persist]
32
+ rake "db:migrate"
33
+ end
34
+
35
+ def self.next_migration_number(path)
36
+ unless @prev_migration_nr
37
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
38
+ else
39
+ @prev_migration_nr += 1
40
+ end
41
+ @prev_migration_nr.to_s
42
+ end
43
+ end
44
+ end