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
@@ -1,10 +1,26 @@
1
- class AaiCreateUser < ActiveRecord::Migration
1
+ class CreateAaiUser < ActiveRecord::Migration
2
2
  def change
3
+
3
4
  create_table(:users) do |t|
4
5
  t.string :uid
6
+ t.string :unique_id
7
+ t.string :persistent_id
8
+ t.string :email
9
+ t.string :first_name
10
+ t.string :last_name
11
+ t.string :home_organization
12
+ t.text :raw_data
5
13
  t.timestamps
6
14
  end
7
15
 
8
- add_index :users, :uid, :unique => true
16
+ # if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
17
+ # add_column :users, :raw_data, :json
18
+ # else
19
+ # add_column :users, :raw_data, :string
20
+ # end
21
+
22
+ add_index :users, :uid, unique: true
23
+ add_index :users, :unique_id, unique: true
24
+ add_index :users, :persistent_id, unique: true
9
25
  end
10
26
  end
@@ -1,11 +1,23 @@
1
1
  Rails.application.config.middleware.use OmniAuth::Builder do
2
2
  if Rails.env.development?
3
3
  provider :developer, {
4
- :uid_field => :swiss_ep_uid, #:'persistent-id', swiss_ep_uid
5
- :fields => OmniAuth::Strategies::Aai::DEFAULT_FIELDS,
6
- :extra_fields => OmniAuth::Strategies::Aai::DEFAULT_EXTRA_FIELDS
7
- }
4
+ uid_field: 'persistent-id',
5
+ fields: [:name, :email, :persistent_id, :unique_id]
6
+ }
8
7
  else
9
- provider :aai
8
+ provider :aai, {
9
+ uid_field: "uid", # Defaults to :'persistent-id'. Alternative :unique_id
10
+ name_field: "displayName",
11
+ info_fields: {
12
+ unique_id: "uniqueID",
13
+ persistent_id: "persistent-id",
14
+ email: "mail",
15
+ first_name: "givenName",
16
+ last_name: "surname",
17
+ home_organization: "homeOrganization",
18
+ preferred_language: "preferredLanguage",
19
+ affiliation: "affiliation"
20
+ }
21
+ }
10
22
  end
11
- end
23
+ end
@@ -1,12 +1,11 @@
1
1
  class SessionController < ApplicationController
2
2
 
3
+ skip_before_filter :verify_authenticity_token, only: :create, if: Rails.env.development?
4
+
3
5
  def create
4
6
 
5
7
  <% if options[:persist] %>
6
- #Add whatever fields you want to save
7
- self.current_user = User.find_or_create_by_uid( auth_hash[:uid] )
8
- #Auth Hash is not persistent
9
- self.current_user.aai = auth_hash
8
+ self.current_user = User.update_or_create_with_omniauth_aai(auth_hash)
10
9
  <% else %>
11
10
  user = User.new
12
11
  user.uid = auth_hash[:uid]
@@ -30,11 +29,10 @@ class SessionController < ApplicationController
30
29
  redirect_to(root_path)
31
30
  end
32
31
 
33
-
34
- protected
32
+ private
35
33
 
36
34
  def auth_hash
37
35
  request.env['omniauth.auth']
38
36
  end
39
-
40
- end
37
+
38
+ end
@@ -1,8 +1,32 @@
1
1
  class User <%= options[:persist] ? "< ActiveRecord::Base" : "" %>
2
2
  <% if options[:persist] %>
3
- attr_accessible :uid
3
+ # attr_accessible :uid
4
4
  attr_accessor :aai
5
5
  PERSISTENT = true
6
+
7
+ def self.update_or_create_with_omniauth_aai(omniauth_aai)
8
+ user = find_or_build_with_uid(omniauth_aai['uid'])
9
+ user.attributes = {
10
+ unique_id: omniauth_aai.info.unique_id,
11
+ persistent_id: omniauth_aai.info.persistent_id,
12
+ email: omniauth_aai.info.email,
13
+ first_name: omniauth_aai.info.first_name,
14
+ last_name: omniauth_aai.info.last_name,
15
+ home_organization: omniauth_aai.info.home_organization,
16
+ # affiliation: omniauth_aai.info.affiliation,
17
+ raw_data: omniauth_aai.respond_to?(:to_hash) ? omniauth_aai.to_hash : omniauth_aai.inspect
18
+ }
19
+ user.save
20
+ user
21
+ end
22
+
23
+ def self.find_or_build_with_uid(aai_uid)
24
+ if aai_uid.present?
25
+ where(uid: aai_uid).first || new(uid: aai_uid)
26
+ else
27
+ new
28
+ end
29
+ end
6
30
  <% else %>
7
31
  attr_accessor :aai, :uid
8
32
  PERSISTENT = false
@@ -21,7 +45,6 @@ class User <%= options[:persist] ? "< ActiveRecord::Base" : "" %>
21
45
  end
22
46
 
23
47
  <% if options[:persist] %>
24
-
25
48
  def marshal
26
49
  self.uid
27
50
  end
@@ -33,7 +56,6 @@ class User <%= options[:persist] ? "< ActiveRecord::Base" : "" %>
33
56
  def unmarshal(session_data)
34
57
  self.reload
35
58
  end
36
-
37
59
  <% else %>
38
60
  def marshal
39
61
  {
@@ -52,11 +74,5 @@ class User <%= options[:persist] ? "< ActiveRecord::Base" : "" %>
52
74
  self.uid = session_data[:id]
53
75
  self.aai = session_data[:aai]
54
76
  end
55
-
56
77
  <% end %>
57
-
58
- #def shib_session_id
59
- # aai["extra"]["raw_info"]['Shib-Session-ID']
60
- #end
61
- #
62
78
  end
data/lib/omniauth-aai.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "omniauth-aai/version"
2
2
  require "omniauth"
3
- require "action_controller/has_current_user"
3
+ require "omniauth/has_current_user"
4
+ # require "action_controller/has_current_user"
4
5
 
5
6
  module OmniAuth
6
7
  module Strategies
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Aai
3
- VERSION = "0.5.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
@@ -0,0 +1,57 @@
1
+ require 'active_support/concern'
2
+
3
+ module Omniauth
4
+ module HasCurrentUser
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ helper_method :current_user
9
+ end
10
+
11
+ module ClassMethods
12
+ def has_current_user
13
+ include Omniauth::HasCurrentUser::InstanceMethods
14
+ end
15
+ end
16
+
17
+ module InstanceMethods
18
+ @user = nil
19
+
20
+ def current_user
21
+ return nil unless @user.present? || session[:current_user].present?
22
+ @user = @user || User.unmarshal( session[:current_user] )
23
+ @user
24
+ end
25
+
26
+ # Set the current user
27
+ def current_user=(user)
28
+ @user = user
29
+ session[:current_user] = @user.marshal unless @user.nil?
30
+ end
31
+
32
+ # Authenticate User
33
+ def authenticate!
34
+ return if authenticated?
35
+ session[:return_to] = request.url
36
+ if Rails.env.development?
37
+ redirect_to "/auth/developer"
38
+ else
39
+ redirect_to "/auth/aai"
40
+ end
41
+ end
42
+
43
+ # User authenticated?
44
+ def authenticated?
45
+ return true if self.current_user.present? && self.current_user.uid.present?
46
+ return false
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+
53
+ begin
54
+ ActionController::Base.send :include, Omniauth::HasCurrentUser
55
+ rescue NameError => e
56
+ puts "ActionController undefined"
57
+ end
@@ -3,80 +3,71 @@ module OmniAuth
3
3
  module Strategies
4
4
  class Aai < OmniAuth::Strategies::Shibboleth
5
5
 
6
- # 8 core attributes, which must be available for all users
6
+
7
+ # 8 core attributes available for all users
7
8
  CORE_ATTRIBUTES = {
8
- swiss_ep_uid: [:'uniqueID'],
9
- surname: [:'surname'],
10
- first_name: [:'givenName'],
11
- mail: [:'mail'],
12
- homeOrganization: [:'homeOrganization'],
13
- homeOrganizationType: [:'homeOrganizationType'],
14
- affiliation: [:'affiliation']
15
- # swiss_ep_uid: [:'Shib-SwissEP-UniqueID'],
16
- # first_name: [:'Shib-InetOrgPerson-givenName'],
17
- # surname: [:'Shib-Person-surname'],
18
- # mail: [:'Shib-InetOrgPerson-mail'],
19
- # homeOrganization: [:'Shib-SwissEP-HomeOrganization'],
20
- # homeOrganizationType: [:'Shib-SwissEP-HomeOrganizationType'],
21
- # affiliation: [:'Shib-EP-Affiliation']
9
+ unique_id: "uniqueID",
10
+ persistent_id: "persistent-id",
11
+ email: "mail",
12
+ first_name: "givenName",
13
+ last_name: "surname",
14
+ home_organization: "homeOrganization",
15
+ home_organization_type: "homeOrganizationType",
16
+ affiliation: "affiliation"
22
17
  }
23
18
 
24
- # 8 or more Shibboleth attributes, set by the Service Provider automatically if a user has a valid session
19
+ # 8 or more Shibboleth attributes, set by the Service Provider automatically for users with a valid session
25
20
  SHIBBOLETH_ATTRIBUTES = {
26
- :entitlement => [:'entitlement'],
27
- :preferredLanguage => [:'preferredLanguage'],
28
- :'Shib-Application-ID' => [],
29
- :'Shib-Assertion-01' => [],
30
- :'Shib-Assertion-Count' => [],
31
- :'Shib-Authentication-Instant' => [],
32
- :'Shib-Authentication-Method' => [],
33
- :'Shib-AuthnContext-Class' => [],
34
- :'Shib-Identity-Provider' => [],
35
- :'Shib-Session-ID' => []
36
- # :entitlement => [:'Shib-EP-Entitlement'],
37
- # :preferredLanguage => [:'Shib-InetOrgPerson-preferredLanguage'],
38
- # :'Shib-Application-ID' => [],
39
- # :'Shib-Assertion-01' => [],
40
- # :'Shib-Assertion-Count' => [],
41
- # :'Shib-Authentication-Instant' => [],
42
- # :'Shib-Authentication-Method' => [],
43
- # :'Shib-AuthnContext-Class' => [],
44
- # :'Shib-Identity-Provider' => [],
45
- # :'Shib-Session-ID' => []
21
+ entitlement: 'entitlement',
22
+ preferredLanguage: 'preferredLanguage'
23
+ # :'Shib-Application-ID' => [],
24
+ # :'Shib-Assertion-01' => [],
25
+ # :'Shib-Assertion-Count' => [],
26
+ # :'Shib-Authentication-Instant' => [],
27
+ # :'Shib-Authentication-Method' => [],
28
+ # :'Shib-AuthnContext-Class' => [],
29
+ # :'Shib-Identity-Provider' => [],
30
+ # :'Shib-Session-ID' => []
46
31
  }
47
32
 
48
- DEFAULT_EXTRA_FIELDS = (CORE_ATTRIBUTES.keys + SHIBBOLETH_ATTRIBUTES.keys)
49
- DEFAULT_FIELDS = [:name, :email, :swiss_ep_uid ]
50
-
51
- # persistent-id is default uid
52
- option :uid_field, :'persistent-id'
33
+ # DEFAULT_FIELDS = [:name, :email, :persistent_id, :unique_id]
34
+ DEFAULT_EXTRA_FIELDS = (SHIBBOLETH_ATTRIBUTES.keys)
35
+ # DEFAULT_EXTRA_FIELDS = (CORE_ATTRIBUTES.keys + SHIBBOLETH_ATTRIBUTES.keys)
53
36
 
54
- option :debug, false
37
+ option :uid_field, 'persistent-id'
38
+ option :name_field, 'displayName'
39
+ option :email_field, 'mail'
40
+ # option :fields, DEFAULT_FIELDS
41
+ # option :info_fields, {}
42
+ option :info_fields, CORE_ATTRIBUTES
43
+ option :extra_fields, DEFAULT_EXTRA_FIELDS
44
+ # option :aai_fields, CORE_ATTRIBUTES
45
+ # option :aai_extra_fields, SHIBBOLETH_ATTRIBUTES
55
46
 
56
- option :aai_fields, CORE_ATTRIBUTES
47
+ # Attributes checked to find out if there is a valid shibboleth session
48
+ option :shib_session_id_field, 'Shib-Session-ID'
49
+ option :shib_application_id_field, 'Shib-Application-ID'
57
50
 
58
- option :aai_extra_fields, SHIBBOLETH_ATTRIBUTES
51
+ option :request_type, :env
52
+ option :debug, false
59
53
 
60
- option :fields, DEFAULT_FIELDS
61
- option :extra_fields, DEFAULT_EXTRA_FIELDS
62
54
 
63
55
  # # # # #
64
56
  # Helper Methods
65
57
  # # # # #
66
- def aai_attributes
67
- options.aai_extra_fields.merge(options.aai_fields)
68
- end
69
58
 
70
- def read_env( attribute_key )
71
- ([attribute_key] + (aai_attributes[attribute_key] || [])).each do | a |
72
- v = request.env[a.to_s]
73
- return v unless v.nil? || v.strip == ""
74
- end
75
- end
59
+ # def aai_attributes
60
+ # options.aai_extra_fields.merge(options.aai_fields)
61
+ # end
62
+
63
+ # def read_env( attribute_key )
64
+ # ([attribute_key] + (aai_attributes[attribute_key] || [])).each do | a |
65
+ # v = request.env[a.to_s]
66
+ # return v unless v.nil? || v.strip == ""
67
+ # end
68
+ # end
69
+
76
70
 
77
- # # # # #
78
- # Rack
79
- # # # # #
80
71
  def request_phase
81
72
  [
82
73
  302,
@@ -84,39 +75,77 @@ module OmniAuth
84
75
  'Location' => script_name + callback_path + query_string,
85
76
  'Content-Type' => 'text/plain'
86
77
  },
87
- ["You are being redirected to Shibboleth SP/IdP for sign-in."]
78
+ ["You are being redirected to your SWITCHaai IdP for sign-in."]
88
79
  ]
89
80
  end
90
81
 
91
- def callback_phase
92
- super
93
- end
94
-
95
- uid do
96
- # persistent-id is default uid
97
- request.env[options.uid_field.to_s]
98
- end
99
-
100
- info do
101
- options.fields.inject({}) do |hash, field|
102
- case field
103
- when :name
104
- hash[field] = "#{read_env(:first_name)} #{read_env(:surname)}"
105
- when :email
106
- hash[:email] = read_env(:mail)
107
- else
108
- hash[field] = read_env(field.to_s)
109
- end
110
- hash
111
- end
112
- end
113
-
114
- extra do
115
- options.extra_fields.inject({:raw_info => {}}) do |hash, field|
116
- hash[:raw_info][field] = read_env(field.to_s)
117
- hash
118
- end
119
- end
82
+ # def request_params
83
+ # case options[:request_type]
84
+ # when :env, 'env', :header, 'header'
85
+ # request.env
86
+ # when :params, 'params'
87
+ # request.params
88
+ # end
89
+ # end
90
+
91
+ # def request_param(key)
92
+ # case options[:request_type]
93
+ # when :env, 'env'
94
+ # request.env[key]
95
+ # when :header, 'header'
96
+ # request.env["HTTP_#{key.upcase.gsub('-', '_')}"]
97
+ # when :params, 'params'
98
+ # request.params[key]
99
+ # end
100
+ # end
101
+
102
+ # def callback_phase
103
+ # if options[:debug]
104
+ # # dump attributes
105
+ # return [
106
+ # 200,
107
+ # {
108
+ # 'Content-Type' => 'text/plain'
109
+ # },
110
+ # ["!!!!! This message is generated by omniauth-aai. To remove it set :debug to false. !!!!!\n#{request_params.sort.map {|i| "#{i[0]}: #{i[1]}" }.join("\n")}"]
111
+ # ]
112
+ # end
113
+ # return fail!(:no_aai_session) unless (request_param(options.shib_session_id_field.to_s) || request_param(options.shib_application_id_field.to_s))
114
+ # super
115
+ # end
116
+
117
+ # def option_handler(option_field)
118
+ # if option_field.class == String ||
119
+ # option_field.class == Symbol
120
+ # request_param(option_field.to_s)
121
+ # elsif option_field.class == Proc
122
+ # option_field.call(self.method(:request_param))
123
+ # end
124
+ # end
125
+
126
+ # uid do
127
+ # option_handler(options.uid_field)
128
+ # # persistent-id is default uid
129
+ # # request.env[options.uid_field.to_s]
130
+ # end
131
+
132
+ # info do
133
+ # res = {
134
+ # name: option_handler(options.name_field),
135
+ # email: option_handler(options.email_field)
136
+ # }
137
+ # options.info_fields.each_pair do |key, field|
138
+ # res[key] = option_handler(field)
139
+ # end
140
+ # res
141
+ # end
142
+
143
+ # extra do
144
+ # options.extra_fields.inject({:raw_info => {}}) do |hash, field|
145
+ # hash[:raw_info][field] = request_param(field.to_s)
146
+ # hash
147
+ # end
148
+ # end
120
149
 
121
150
  end
122
151
  end