Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clearing out everything to move towards the new 1.0 independent gems …

…strategy.
  • Loading branch information...
commit cc73281406882b65a1f311004a7dab202856e56f 1 parent 9f81195
@mbleigh mbleigh authored
Showing with 60 additions and 10,805 deletions.
  1. +1 −12 Gemfile
  2. +0 −27 Guardfile
  3. +0 −19 LICENSE.md
  4. +5 −50 Rakefile
  5. +0 −6 lib/omniauth.rb
  6. 0  {oa-core → }/lib/omniauth/auth_hash.rb
  7. +1 −0  lib/omniauth/core.rb
  8. +6 −1 lib/omniauth/form.rb
  9. +18 −6 lib/omniauth/strategy.rb
  10. 0  {oa-core → }/oa-core.gemspec
  11. 0  oa-core/.gemtest
  12. +0 −3  oa-core/.rspec
  13. +0 −4 oa-core/.yardopts
  14. +0 −3  oa-core/Gemfile
  15. +0 −19 oa-core/LICENSE
  16. +0 −6 oa-core/Rakefile
  17. +0 −1  oa-core/autotest/discover.rb
  18. +0 −1  oa-core/lib/oa-core.rb
  19. +0 −33 oa-core/lib/omniauth/builder.rb
  20. +0 −141 oa-core/lib/omniauth/core.rb
  21. +0 −191 oa-core/lib/omniauth/form.rb
  22. +0 −242 oa-core/lib/omniauth/strategy.rb
  23. +0 −12 oa-core/lib/omniauth/test.rb
  24. +0 −8 oa-core/lib/omniauth/test/phony_session.rb
  25. +0 −34 oa-core/lib/omniauth/test/strategy_macros.rb
  26. +0 −49 oa-core/lib/omniauth/test/strategy_test_case.rb
  27. +0 −19 oa-core/lib/omniauth/version.rb
  28. +0 −20 oa-core/spec/omniauth/builder_spec.rb
  29. +0 −79 oa-core/spec/omniauth/core_spec.rb
  30. +0 −397 oa-core/spec/omniauth/strategy_spec.rb
  31. +0 −12 oa-core/spec/spec_helper.rb
  32. 0  oa-enterprise/.gemtest
  33. +0 −3  oa-enterprise/.rspec
  34. +0 −4 oa-enterprise/.yardopts
  35. +0 −11 oa-enterprise/Gemfile
  36. +0 −19 oa-enterprise/LICENSE
  37. +0 −115 oa-enterprise/README.rdoc
  38. +0 −6 oa-enterprise/Rakefile
  39. +0 −1  oa-enterprise/lib/oa-enterprise.rb
  40. +0 −9 oa-enterprise/lib/omniauth/enterprise.rb
  41. +0 −47 oa-enterprise/lib/omniauth/strategies/cas.rb
  42. +0 −98 oa-enterprise/lib/omniauth/strategies/cas/configuration.rb
  43. +0 −91 oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb
  44. +0 −124 oa-enterprise/lib/omniauth/strategies/ldap.rb
  45. +0 −276 oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb
  46. +0 −50 oa-enterprise/lib/omniauth/strategies/saml.rb
  47. +0 −38 oa-enterprise/lib/omniauth/strategies/saml/auth_request.rb
  48. +0 −141 oa-enterprise/lib/omniauth/strategies/saml/auth_response.rb
  49. +0 −8 oa-enterprise/lib/omniauth/strategies/saml/validation_error.rb
  50. +0 −126 oa-enterprise/lib/omniauth/strategies/saml/xml_security.rb
  51. +0 −19 oa-enterprise/lib/omniauth/version.rb
  52. +0 −31 oa-enterprise/oa-enterprise.gemspec
  53. +0 −4 oa-enterprise/spec/fixtures/cas_failure.xml
  54. +0 −8 oa-enterprise/spec/fixtures/cas_success.xml
  55. +0 −94 oa-enterprise/spec/omniauth/strategies/cas_spec.rb
  56. +0 −41 oa-enterprise/spec/omniauth/strategies/ldap_spec.rb
  57. +0 −37 oa-enterprise/spec/omniauth/strategies/saml_spec.rb
  58. +0 −14 oa-enterprise/spec/spec_helper.rb
  59. +0 −2  oa-identity/.rspec
  60. +0 −90 oa-identity/README.markdown
  61. +0 −8 oa-identity/Rakefile
  62. +0 −1  oa-identity/lib/oa-identity.rb
  63. +0 −17 oa-identity/lib/omniauth/identity.rb
  64. +0 −119 oa-identity/lib/omniauth/identity/model.rb
  65. +0 −24 oa-identity/lib/omniauth/identity/models/active_record.rb
  66. +0 −78 oa-identity/lib/omniauth/identity/secure_password.rb
  67. +0 −96 oa-identity/lib/omniauth/strategies/identity.rb
  68. +0 −27 oa-identity/oa-identity.gemspec
  69. +0 −123 oa-identity/spec/omniauth/identity/model_spec.rb
  70. +0 −16 oa-identity/spec/omniauth/identity/models/active_record_spec.rb
  71. +0 −27 oa-identity/spec/omniauth/identity/secure_password_spec.rb
  72. +0 −130 oa-identity/spec/omniauth/strategies/identity_spec.rb
  73. +0 −14 oa-identity/spec/spec_helper.rb
  74. 0  oa-more/.gemtest
  75. +0 −3  oa-more/.rspec
  76. +0 −4 oa-more/.yardopts
  77. +0 −11 oa-more/Gemfile
  78. +0 −19 oa-more/LICENSE
  79. +0 −22 oa-more/README.rdoc
  80. +0 −6 oa-more/Rakefile
  81. +0 −1  oa-more/lib/oa-more.rb
  82. +0 −12 oa-more/lib/omniauth/more.rb
  83. +0 −104 oa-more/lib/omniauth/strategies/draugiem.rb
  84. +0 −56 oa-more/lib/omniauth/strategies/http_basic.rb
  85. +0 −93 oa-more/lib/omniauth/strategies/ign.rb
  86. +0 −93 oa-more/lib/omniauth/strategies/last_fm.rb
  87. +0 −39 oa-more/lib/omniauth/strategies/windows_live.rb
  88. +0 −1,143 oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb
  89. +0 −67 oa-more/lib/omniauth/strategies/yupoo.rb
  90. +0 −19 oa-more/lib/omniauth/version.rb
  91. +0 −27 oa-more/oa-more.gemspec
  92. +0 −51 oa-more/spec/omniauth/strategies/draugiem_spec.rb
  93. +0 −7 oa-more/spec/omniauth/strategies/http_basic_spec.rb
  94. +0 −7 oa-more/spec/omniauth/strategies/last_fm_spec.rb
  95. +0 −11 oa-more/spec/spec_helper.rb
  96. 0  oa-oauth/.gemtest
  97. +0 −3  oa-oauth/.rspec
  98. +0 −4 oa-oauth/.yardopts
  99. +0 −11 oa-oauth/Gemfile
  100. +0 −19 oa-oauth/LICENSE
  101. +0 −35 oa-oauth/README.rdoc
  102. +0 −6 oa-oauth/Rakefile
  103. +0 −1  oa-oauth/autotest/discover.rb
  104. +0 −1  oa-oauth/lib/oa-oauth.rb
  105. +0 −74 oa-oauth/lib/omniauth/oauth.rb
  106. +0 −59 oa-oauth/lib/omniauth/strategies/google_oauth2.rb
  107. +0 −89 oa-oauth/lib/omniauth/strategies/oauth.rb
  108. +0 −58 oa-oauth/lib/omniauth/strategies/oauth/blogger.rb
  109. +0 −51 oa-oauth/lib/omniauth/strategies/oauth/dopplr.rb
  110. +0 −60 oa-oauth/lib/omniauth/strategies/oauth/douban.rb
  111. +0 −40 oa-oauth/lib/omniauth/strategies/oauth/dropbox.rb
  112. +0 −52 oa-oauth/lib/omniauth/strategies/oauth/evernote.rb
  113. +0 −47 oa-oauth/lib/omniauth/strategies/oauth/flattr.rb
  114. +0 −39 oa-oauth/lib/omniauth/strategies/oauth/flickr.rb
  115. +0 −44 oa-oauth/lib/omniauth/strategies/oauth/goodreads.rb
  116. +0 −79 oa-oauth/lib/omniauth/strategies/oauth/google.rb
  117. +0 −71 oa-oauth/lib/omniauth/strategies/oauth/google_health.rb
  118. +0 −74 oa-oauth/lib/omniauth/strategies/oauth/google_health_sandbox.rb
  119. +0 −69 oa-oauth/lib/omniauth/strategies/oauth/hyves.rb
  120. +0 −53 oa-oauth/lib/omniauth/strategies/oauth/identica.rb
  121. +0 −56 oa-oauth/lib/omniauth/strategies/oauth/linked_in.rb
  122. +0 −58 oa-oauth/lib/omniauth/strategies/oauth/meetup.rb
  123. +0 −48 oa-oauth/lib/omniauth/strategies/oauth/miso.rb
  124. +0 −67 oa-oauth/lib/omniauth/strategies/oauth/netflix.rb
  125. +0 −63 oa-oauth/lib/omniauth/strategies/oauth/orkut.rb
  126. +0 −57 oa-oauth/lib/omniauth/strategies/oauth/plurk.rb
  127. +0 −72 oa-oauth/lib/omniauth/strategies/oauth/qzone.rb
  128. +0 −48 oa-oauth/lib/omniauth/strategies/oauth/rdio.rb
  129. +0 −47 oa-oauth/lib/omniauth/strategies/oauth/smug_mug.rb
  130. +0 −57 oa-oauth/lib/omniauth/strategies/oauth/t163.rb
  131. +0 −63 oa-oauth/lib/omniauth/strategies/oauth/tqq.rb
  132. +0 −50 oa-oauth/lib/omniauth/strategies/oauth/trade_me.rb
  133. +0 −24 oa-oauth/lib/omniauth/strategies/oauth/trip_it.rb
  134. +0 −85 oa-oauth/lib/omniauth/strategies/oauth/tsina.rb
  135. +0 −55 oa-oauth/lib/omniauth/strategies/oauth/tsohu.rb
  136. +0 −58 oa-oauth/lib/omniauth/strategies/oauth/tumblr.rb
  137. +0 −58 oa-oauth/lib/omniauth/strategies/oauth/twitter.rb
  138. +0 −67 oa-oauth/lib/omniauth/strategies/oauth/type_pad.rb
  139. +0 −58 oa-oauth/lib/omniauth/strategies/oauth/vimeo.rb
  140. +0 −60 oa-oauth/lib/omniauth/strategies/oauth/yahoo.rb
  141. +0 −48 oa-oauth/lib/omniauth/strategies/oauth/yammer.rb
  142. +0 −75 oa-oauth/lib/omniauth/strategies/oauth/you_tube.rb
  143. +0 −93 oa-oauth/lib/omniauth/strategies/oauth2.rb
  144. +0 −57 oa-oauth/lib/omniauth/strategies/oauth2/angellist.rb
  145. +0 −43 oa-oauth/lib/omniauth/strategies/oauth2/bitly.rb
  146. +0 −54 oa-oauth/lib/omniauth/strategies/oauth2/cobot.rb
  147. +0 −63 oa-oauth/lib/omniauth/strategies/oauth2/dailymile.rb
  148. +0 −60 oa-oauth/lib/omniauth/strategies/oauth2/doit.rb
  149. +0 −87 oa-oauth/lib/omniauth/strategies/oauth2/facebook.rb
  150. +0 −63 oa-oauth/lib/omniauth/strategies/oauth2/foursquare.rb
  151. +0 −52 oa-oauth/lib/omniauth/strategies/oauth2/github.rb
  152. +0 −45 oa-oauth/lib/omniauth/strategies/oauth2/glitch.rb
  153. +0 −72 oa-oauth/lib/omniauth/strategies/oauth2/gowalla.rb
  154. +0 −58 oa-oauth/lib/omniauth/strategies/oauth2/instagram.rb
  155. +0 −67 oa-oauth/lib/omniauth/strategies/oauth2/liveid.rb
  156. +0 −39 oa-oauth/lib/omniauth/strategies/oauth2/mailchimp.rb
  157. +0 −75 oa-oauth/lib/omniauth/strategies/oauth2/mailru.rb
  158. +0 −64 oa-oauth/lib/omniauth/strategies/oauth2/mixi.rb
  159. +0 −89 oa-oauth/lib/omniauth/strategies/oauth2/renren.rb
  160. +0 −48 oa-oauth/lib/omniauth/strategies/oauth2/salesforce.rb
  161. +0 −60 oa-oauth/lib/omniauth/strategies/oauth2/sound_cloud.rb
  162. +0 −81 oa-oauth/lib/omniauth/strategies/oauth2/taobao.rb
  163. +0 −51 oa-oauth/lib/omniauth/strategies/oauth2/teambox.rb
  164. +0 −41 oa-oauth/lib/omniauth/strategies/oauth2/thirty_seven_signals.rb
  165. +0 −72 oa-oauth/lib/omniauth/strategies/oauth2/viadeo.rb
  166. +0 −104 oa-oauth/lib/omniauth/strategies/oauth2/vkontakte.rb
  167. +0 −48 oa-oauth/lib/omniauth/strategies/oauth2/we_pay.rb
  168. +0 −67 oa-oauth/lib/omniauth/strategies/xauth.rb
  169. +0 −37 oa-oauth/lib/omniauth/strategies/xauth/instapaper.rb
  170. +0 −19 oa-oauth/lib/omniauth/version.rb
  171. +0 −31 oa-oauth/oa-oauth.gemspec
  172. +0 −24 oa-oauth/spec/fixtures/basecamp_200.xml
  173. +0 −10 oa-oauth/spec/fixtures/campfire_200.json
  174. +0 −5 oa-oauth/spec/omniauth/strategies/google_oauth2_spec.rb
  175. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/dopplr_spec.rb
  176. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/douban_spec.rb
  177. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/dropbox_spec.rb
  178. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/evernote_spec.rb
  179. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/flattr_spec.rb
  180. +0 −6 oa-oauth/spec/omniauth/strategies/oauth/flickr_spec.rb
  181. +0 −6 oa-oauth/spec/omniauth/strategies/oauth/goodreads_spec.rb
  182. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/google_health_sandbox_spec.rb
  183. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/google_health_spec.rb
  184. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/google_spec.rb
  185. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/hyves_spec.rb
  186. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/identica_spec.rb
  187. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/linked_in_spec.rb
  188. +0 −14 oa-oauth/spec/omniauth/strategies/oauth/meetup_spec.rb
  189. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/miso_spec.rb
  190. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/netflix_spec.rb
  191. +0 −131 oa-oauth/spec/omniauth/strategies/oauth/oauth_spec.rb
  192. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/orkut_spec.rb
  193. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/plurk_spec.rb
  194. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/rdio_spec.rb
  195. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/smug_mug_spec.rb
  196. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/t163_spec.rb
  197. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/trade_me_spec.rb
  198. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/trip_it_spec.rb
  199. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/tsina_spec.rb
  200. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/tumblr_spec.rb
  201. +0 −43 oa-oauth/spec/omniauth/strategies/oauth/twitter_spec.rb
  202. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/type_pad_spec.rb
  203. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/vimeo_spec.rb
  204. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/yahoo_spec.rb
  205. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/yammer_spec.rb
  206. +0 −5 oa-oauth/spec/omniauth/strategies/oauth/you_tube_spec.rb
  207. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/angellist_spec.rb
  208. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/bitly_spec.rb
  209. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/cobot_spec.rb
  210. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/dailymile_spec.rb
  211. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/doit_spec.rb
  212. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/facebook_spec.rb
  213. +0 −18 oa-oauth/spec/omniauth/strategies/oauth2/foursquare_spec.rb
  214. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/github_spec.rb
  215. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/glitch_spec.rb
  216. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/gowalla_spec.rb
  217. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/instagram_spec.rb
  218. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/liveid_spec.rb
  219. +0 −6 oa-oauth/spec/omniauth/strategies/oauth2/mailchimp_spec.rb
  220. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/mailru_spec.rb
  221. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/salesforce_spec.rb
  222. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/sound_cloud_spec.rb
  223. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/taobao_spec.rb
  224. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/teambox_spec.rb
  225. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/thirty_seven_signals_spec.rb
  226. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/viadeo_spec.rb
  227. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/vkontakte_spec.rb
  228. +0 −5 oa-oauth/spec/omniauth/strategies/oauth2/we_pay_spec.rb
  229. +0 −31 oa-oauth/spec/spec_helper.rb
  230. +0 −29 oa-oauth/spec/support/shared_examples.rb
  231. 0  oa-openid/.gemtest
  232. +0 −3  oa-openid/.rspec
  233. +0 −4 oa-openid/.yardopts
  234. +0 −12 oa-openid/Gemfile
  235. +0 −19 oa-openid/LICENSE
  236. +0 −51 oa-openid/README.rdoc
  237. +0 −6 oa-openid/Rakefile
  238. +0 −1  oa-openid/lib/oa-openid.rb
  239. +0 −61 oa-openid/lib/omniauth/openid.rb
  240. +0 −32 oa-openid/lib/omniauth/openid/gapps.rb
  241. +0 −23 oa-openid/lib/omniauth/strategies/google_apps.rb
  242. +0 −55 oa-openid/lib/omniauth/strategies/google_hybrid.rb
  243. +0 −134 oa-openid/lib/omniauth/strategies/open_id.rb
  244. +0 −55 oa-openid/lib/omniauth/strategies/steam.rb
  245. +0 −19 oa-openid/lib/omniauth/version.rb
  246. +0 −26 oa-openid/oa-openid.gemspec
  247. +0 −63 oa-openid/spec/omniauth/strategies/google_hybrid_spec.rb
  248. +0 −87 oa-openid/spec/omniauth/strategies/open_id_spec.rb
  249. +0 −14 oa-openid/spec/spec_helper.rb
  250. +0 −18 omniauth.gemspec
  251. 0  {oa-core → }/spec/omniauth/auth_hash_spec.rb
  252. +29 −0 spec/omniauth/strategy_spec.rb
  253. +0 −134 tasks/all.rb
View
13 Gemfile
@@ -1,14 +1,3 @@
source 'http://rubygems.org'
-platforms :jruby do
- gem 'jruby-openssl', '~> 0.7'
-end
-
-gemspec :path => 'oa-core'
-gemspec :path => 'oa-enterprise'
-gemspec :path => 'oa-more'
-gemspec :path => 'oa-oauth'
-gemspec :path => 'oa-openid'
-
-gem 'activerecord', '3.1.0.rc1'
-
+gemspec
View
27 Guardfile
@@ -1,27 +0,0 @@
-# A sample Guardfile
-# More info at https://github.com/guard/guard#readme
-
-guard 'rspec', :version => 2 do
- watch(%r{^spec/.+_spec\.rb$})
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
- watch('spec/spec_helper.rb') { "spec/" }
-
- # Rails example
- watch(%r{^spec/.+_spec\.rb$})
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
- watch(%r{^spec/support/(.+)\.rb$}) { "spec/" }
- watch('spec/spec_helper.rb') { "spec/" }
- watch('config/routes.rb') { "spec/routing" }
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
- # Capybara request specs
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
-end
-
-
-guard 'bundler' do
- watch('Gemfile')
- # Uncomment next line if Gemfile contain `gemspec' command
- # watch(/^.+\.gemspec/)
-end
View
19 LICENSE.md
@@ -1,19 +0,0 @@
-Copyright (c) 2010-2011 Michael Bleigh, Erik Michaels-Ober, and Intridea, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
View
55 Rakefile 100755 → 100644
@@ -1,51 +1,6 @@
-#!/usr/bin/env rake
-
-$:.unshift File.expand_path('..', __FILE__)
-require 'tasks/all'
-
-desc 'Clean up temporary files'
-task :clean => 'all:clean'
-
-desc 'Build gem files for all projects into the package directory'
-task :build => 'all:build'
-
-desc 'Build and install gems for all projects'
-task :install => 'all:install'
-
-desc 'Write version with MAJOR, MINOR, PATCH, and PRE environment variables'
-task 'version:write' => 'all:version:write'
-
-desc 'Display the current version for all projects'
-task :version => 'all:version'
-desc 'Increment the major version for all projects'
-task 'version:bump:major' => 'all:version:bump:major'
-desc 'Increment the minor version for all projects'
-task 'version:bump:minor' => 'all:version:bump:minor'
-desc 'Increment the patch version for all projects'
-task 'version:bump:patch' => 'all:version:bump:patch'
-
-desc 'Run specs for all projects'
-task :spec => 'all:spec'
+require 'bundler'
+Bundler::GemHelper.install_tasks
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec)
+task :default => :spec
task :test => :spec
-task :default => :test
-
-desc 'Generate docs for all projects'
-task 'doc:yard' => 'all:doc:yard'
-
-task :tag do
- sh "git tag -a -m \"Version #{version}\" v#{version}"
- sh "git push"
- sh "git push --tags"
-end
-
-task :push => 'all:push'
-
-desc 'Build, tag, and push gems for all projects to Rubygems'
-task :release => [:build, :tag, :push]
-
-namespace :doc do
- require 'yard'
- YARD::Rake::YardocTask.new do |task|
- task.files = PROJECTS.map{|project| "#{root}/#{project}/lib/**/*.rb"} + ['README.markdown', 'LICENSE']
- end
-end
View
6 lib/omniauth.rb
@@ -1,6 +0,0 @@
-require 'omniauth/core'
-require 'omniauth/oauth'
-require 'omniauth/openid'
-require 'omniauth/enterprise'
-require 'omniauth/more'
-require 'omniauth/identity'
View
0  oa-core/lib/omniauth/auth_hash.rb → lib/omniauth/auth_hash.rb
File renamed without changes
View
1  lib/omniauth/core.rb
@@ -8,6 +8,7 @@ module Strategies; end
autoload :Strategy, 'omniauth/strategy'
autoload :Test, 'omniauth/test'
autoload :Form, 'omniauth/form'
+ autoload :AuthHash, 'omniauth/auth_hash'
def self.strategies
@@strategies ||= []
View
7 lib/omniauth/form.rb
@@ -99,7 +99,12 @@ def initialize(options = {})
def self.build(title=nil,&block)
form = OmniAuth::Form.new(title)
- form.instance_eval(&block)
+ if block.arity > 0
+ yield form
+ else
+ form.instance_eval(&block)
+ end
+ form
end
def label_field(text, target)
View
24 lib/omniauth/strategy.rb
@@ -38,12 +38,19 @@ def call!(env)
return mock_call!(env) if OmniAuth.config.test_mode
+ return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
+ # Responds to an OPTIONS request.
+ def options_call
+ verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
+ return [ 200, { 'Allow' => verbs }, [] ]
+ end
+
# Performs the steps necessary to run the request phase of a strategy.
def request_call
setup_phase
@@ -73,11 +80,19 @@ def on_auth_path?
end
def on_request_path?
- current_path.casecmp(request_path) == 0
+ on_path?(request_path)
end
def on_callback_path?
- current_path.casecmp(callback_path) == 0
+ on_path?(callback_path)
+ end
+
+ def on_path?(path)
+ current_path.casecmp(path) == 0
+ end
+
+ def options_request?
+ request.request_method == 'OPTIONS'
end
def mock_call!(env)
@@ -168,10 +183,7 @@ def call_app!(env = @env)
end
def auth_hash
- {
- 'provider' => name.to_s,
- 'uid' => nil
- }
+ AuthHash.new(:provider => name.to_s)
end
def full_host
View
0  oa-core/oa-core.gemspec → oa-core.gemspec
File renamed without changes
View
0  oa-core/.gemtest
No changes.
View
3  oa-core/.rspec
@@ -1,3 +0,0 @@
---color
---format=nested
---backtrace
View
4 oa-core/.yardopts
@@ -1,4 +0,0 @@
---markup markdown
---markup-provider maruku
--
-LICENSE
View
3  oa-core/Gemfile
@@ -1,3 +0,0 @@
-source 'http://rubygems.org'
-
-gemspec
View
19 oa-core/LICENSE
@@ -1,19 +0,0 @@
-Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
View
6 oa-core/Rakefile
@@ -1,6 +0,0 @@
-require 'bundler'
-Bundler::GemHelper.install_tasks
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec)
-task :default => :spec
-task :test => :spec
View
1  oa-core/autotest/discover.rb
@@ -1 +0,0 @@
-Autotest.add_discovery { "rspec2" }
View
1  oa-core/lib/oa-core.rb
@@ -1 +0,0 @@
-require 'omniauth/core'
View
33 oa-core/lib/omniauth/builder.rb
@@ -1,33 +0,0 @@
-require 'omniauth/core'
-
-module OmniAuth
- class Builder < ::Rack::Builder
- def initialize(app, &block)
- @app = app
- super(&block)
- end
-
- def on_failure(&block)
- OmniAuth.config.on_failure = block
- end
-
- def configure(&block)
- OmniAuth.configure(&block)
- end
-
- def provider(klass, *args, &block)
- if klass.is_a?(Class)
- middleware = klass
- else
- middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
- end
-
- use middleware, *args, &block
- end
-
- def call(env)
- @ins << @app unless @ins.include?(@app)
- to_app.call(env)
- end
- end
-end
View
141 oa-core/lib/omniauth/core.rb
@@ -1,141 +0,0 @@
-require 'rack'
-require 'singleton'
-
-module OmniAuth
- module Strategies; end
-
- autoload :Builder, 'omniauth/builder'
- autoload :Strategy, 'omniauth/strategy'
- autoload :Test, 'omniauth/test'
- autoload :Form, 'omniauth/form'
- autoload :AuthHash, 'omniauth/auth_hash'
-
- def self.strategies
- @@strategies ||= []
- end
-
- class Configuration
- include Singleton
-
- @@defaults = {
- :path_prefix => '/auth',
- :on_failure => Proc.new do |env|
- message_key = env['omniauth.error.type']
- new_path = "#{OmniAuth.config.path_prefix}/failure?message=#{message_key}"
- [302, {'Location' => new_path, 'Content-Type'=> 'text/html'}, []]
- end,
- :form_css => Form::DEFAULT_CSS,
- :test_mode => false,
- :allowed_request_methods => [:get, :post],
- :mock_auth => {
- :default => {
- 'provider' => 'default',
- 'uid' => '1234',
- 'user_info' => {
- 'name' => 'Bob Example'
- }
- }
- }
- }
-
- def self.defaults
- @@defaults
- end
-
- def initialize
- @@defaults.each_pair{|k,v| self.send("#{k}=",v)}
- end
-
- def on_failure(&block)
- if block_given?
- @on_failure = block
- else
- @on_failure
- end
- end
-
- def add_mock(provider, mock={})
- # Stringify keys recursively one level.
- mock.keys.each do |key|
- mock[key.to_s] = mock.delete(key)
- end
- mock.each_pair do |key, val|
- if val.is_a? Hash
- val.keys.each do |subkey|
- val[subkey.to_s] = val.delete(subkey)
- end
- end
- end
-
- # Merge with the default mock and ensure provider is correct.
- mock = self.mock_auth[:default].dup.merge(mock)
- mock["provider"] = provider.to_s
-
- # Add it to the mocks.
- self.mock_auth[provider.to_sym] = mock
- end
-
- attr_writer :on_failure
- attr_accessor :path_prefix, :allowed_request_methods, :form_css, :test_mode, :mock_auth, :full_host
- end
-
- def self.config
- Configuration.instance
- end
-
- def self.configure
- yield config
- end
-
- def self.mock_auth_for(provider)
- config.mock_auth[provider.to_sym] || config.mock_auth[:default]
- end
-
- module Utils
- CAMELIZE_SPECIAL = {
- 'oauth' => 'OAuth',
- 'oauth2' => 'OAuth2',
- 'openid' => 'OpenID',
- 'open_id' => 'OpenID',
- 'github' => 'GitHub',
- 'tripit' => 'TripIt',
- 'soundcloud' => 'SoundCloud',
- 'smugmug' => 'SmugMug',
- 'cas' => 'CAS',
- 'trademe' => 'TradeMe',
- 'ldap' => 'LDAP',
- 'google_oauth2' => 'GoogleOAuth2'
- }
-
- module_function
-
- def form_css
- "<style type='text/css'>#{OmniAuth.config.form_css}</style>"
- end
-
- def deep_merge(hash, other_hash)
- target = hash.dup
-
- other_hash.keys.each do |key|
- if other_hash[key].is_a? ::Hash and hash[key].is_a? ::Hash
- target[key] = deep_merge(target[key],other_hash[key])
- next
- end
-
- target[key] = other_hash[key]
- end
-
- target
- end
-
- def camelize(word, first_letter_in_uppercase = true)
- return CAMELIZE_SPECIAL[word.to_s] if CAMELIZE_SPECIAL[word.to_s]
-
- if first_letter_in_uppercase
- word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
- else
- word.first + camelize(word)[1..-1]
- end
- end
- end
-end
View
191 oa-core/lib/omniauth/form.rb
@@ -1,191 +0,0 @@
-require 'omniauth/core'
-
-module OmniAuth
- class Form
- DEFAULT_CSS = <<-CSS
- body {
- background: #ccc;
- font-family: "Lucida Grande", "Lucida Sans", Helvetica, Arial, sans-serif;
- }
-
- h1 {
- text-align: center;
- margin: 30px auto 0px;
- font-size: 18px;
- padding: 10px 10px 15px;
- background: #555;
- color: white;
- width: 320px;
- border: 10px solid #444;
- border-bottom: 0;
- -moz-border-radius-topleft: 10px;
- -moz-border-radius-topright: 10px;
- -webkit-border-top-left-radius: 10px;
- -webkit-border-top-right-radius: 10px;
- border-top-left-radius: 10px;
- border-top-right-radius: 10px;
- }
-
- h1, form {
- -moz-box-shadow: 2px 2px 7px rgba(0,0,0,0.3);
- -webkit-box-shadow: 2px 2px 7px rgba(0,0,0,0.3);
- }
-
- form {
- background: white;
- border: 10px solid #eee;
- border-top: 0;
- padding: 20px;
- margin: 0px auto 40px;
- width: 300px;
- -moz-border-radius-bottomleft: 10px;
- -moz-border-radius-bottomright: 10px;
- -webkit-border-bottom-left-radius: 10px;
- -webkit-border-bottom-right-radius: 10px;
- border-bottom-left-radius: 10px;
- border-bottom-right-radius: 10px;
- }
-
- label {
- display: block;
- font-weight: bold;
- margin-bottom: 5px;
- }
-
- input {
- font-size: 18px;
- padding: 4px 8px;
- display: block;
- margin-bottom: 10px;
- width: 280px;
- }
-
- input#identifier, input#openid_url {
- background: url(http://openid.net/login-bg.gif) no-repeat;
- background-position: 0 50%;
- padding-left: 18px;
- }
-
- button {
- font-size: 22px;
- padding: 4px 8px;
- display: block;
- margin: 20px auto 0;
- }
-
- fieldset {
- border: 1px solid #ccc;
- border-left: 0;
- border-right: 0;
- padding: 10px 0;
- }
-
- fieldset input {
- width: 260px;
- font-size: 16px;
- }
- CSS
-
- attr_accessor :options
-
- def initialize(options = {})
- options[:title] ||= "Authentication Info Required"
- options[:header_info] ||= ""
- self.options = options
-
- @html = ""
- header(options[:title],options[:header_info])
- end
-
- def self.build(title=nil,&block)
- form = OmniAuth::Form.new(title)
- if block.arity > 0
- yield form
- else
- form.instance_eval(&block)
- end
- form
- end
-
- def label_field(text, target)
- @html << "\n<label for='#{target}'>#{text}:</label>"
- self
- end
-
- def input_field(type, name)
- @html << "\n<input type='#{type}' id='#{name}' name='#{name}'/>"
- self
- end
-
- def text_field(label, name)
- label_field(label, name)
- input_field('text', name)
- self
- end
-
- def password_field(label, name)
- label_field(label, name)
- input_field('password', name)
- self
- end
-
- def button(text)
- @html << "\n<button type='submit'>#{text}</button>"
- end
-
- def html(html)
- @html << html
- end
-
- def fieldset(legend, options = {}, &block)
- @html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n <legend>#{legend}</legend>\n"
- self.instance_eval &block
- @html << "\n</fieldset>"
- self
- end
-
- def header(title,header_info)
- @html << <<-HTML
- <!DOCTYPE html>
- <html>
- <head>
- <title>#{title}</title>
- #{css}
- #{header_info}
- </head>
- <body>
- <h1>#{title}</h1>
- <form method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
- HTML
- self
- end
-
- def footer
- return self if @footer
- @html << <<-HTML
- <button type='submit'>Connect</button>
- </form>
- </body>
- </html>
- HTML
- @footer = true
- self
- end
-
- def to_html
- footer
- @html
- end
-
- def to_response
- footer
- Rack::Response.new(@html).finish
- end
-
- protected
-
- def css
- "\n<style type='text/css'>#{OmniAuth.config.form_css}</style>"
- end
- end
-end
View
242 oa-core/lib/omniauth/strategy.rb
@@ -1,242 +0,0 @@
-require 'omniauth/core'
-
-module OmniAuth
- class NoSessionError < StandardError; end
- # The Strategy is the base unit of OmniAuth's ability to
- # wrangle multiple providers. Each strategy provided by
- # OmniAuth includes this mixin to gain the default functionality
- # necessary to be compatible with the OmniAuth library.
- module Strategy
- def self.included(base)
- OmniAuth.strategies << base
- base.class_eval do
- attr_reader :app, :name, :env, :options, :response
- end
- end
-
- def initialize(app, name, *args, &block)
- @app = app
- @name = name.to_sym
- @options = args.last.is_a?(Hash) ? args.pop : {}
-
- yield self if block_given?
- end
-
- def inspect
- "#<#{self.class.to_s}>"
- end
-
- def call(env)
- dup.call!(env)
- end
-
- def call!(env)
- raise OmniAuth::NoSessionError.new("You must provide a session to use OmniAuth.") unless env['rack.session']
-
- @env = env
- @env['omniauth.strategy'] = self if on_auth_path?
-
- return mock_call!(env) if OmniAuth.config.test_mode
-
- return options_call if on_auth_path? && options_request?
- return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
- return callback_call if on_callback_path?
- return other_phase if respond_to?(:other_phase)
- @app.call(env)
- end
-
- # Responds to an OPTIONS request.
- def options_call
- verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
- return [ 200, { 'Allow' => verbs }, [] ]
- end
-
- # Performs the steps necessary to run the request phase of a strategy.
- def request_call
- setup_phase
- if response = call_through_to_app
- response
- else
- if request.params['origin']
- @env['rack.session']['omniauth.origin'] = request.params['origin']
- elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
- @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
- end
- request_phase
- end
- end
-
- # Performs the steps necessary to run the callback phase of a strategy.
- def callback_call
- setup_phase
- @env['omniauth.origin'] = session.delete('omniauth.origin')
- @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
-
- callback_phase
- end
-
- def on_auth_path?
- on_request_path? || on_callback_path?
- end
-
- def on_request_path?
- on_path?(request_path)
- end
-
- def on_callback_path?
- on_path?(callback_path)
- end
-
- def on_path?(path)
- current_path.casecmp(path) == 0
- end
-
- def options_request?
- request.request_method == 'OPTIONS'
- end
-
- def mock_call!(env)
- return mock_request_call if on_request_path?
- return mock_callback_call if on_callback_path?
- call_app!
- end
-
- def mock_request_call
- setup_phase
- return response if response = call_through_to_app
-
- if request.params['origin']
- @env['rack.session']['omniauth.origin'] = request.params['origin']
- elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
- @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
- end
- redirect(script_name + callback_path + query_string)
- end
-
- def mock_callback_call
- setup_phase
- mocked_auth = OmniAuth.mock_auth_for(name.to_sym)
- if mocked_auth.is_a?(Symbol)
- fail!(mocked_auth)
- else
- @env['omniauth.auth'] = mocked_auth
- @env['omniauth.origin'] = session.delete('omniauth.origin')
- @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
- call_app!
- end
- end
-
- def setup_phase
- if options[:setup].respond_to?(:call)
- options[:setup].call(env)
- elsif options[:setup]
- setup_env = env.merge('PATH_INFO' => setup_path, 'REQUEST_METHOD' => 'GET')
- call_app!(setup_env)
- end
- end
-
- def request_phase
- raise NotImplementedError
- end
-
- def callback_phase
- @env['omniauth.auth'] = auth_hash
- @env['omniauth.params'] = session['query_params'] || {}
- session['query_params'] = nil if session['query_params']
- call_app!
- end
-
- def path_prefix
- options[:path_prefix] || OmniAuth.config.path_prefix
- end
-
- def request_path
- options[:request_path] || "#{path_prefix}/#{name}"
- end
-
- def callback_path
- options[:callback_path] || "#{path_prefix}/#{name}/callback"
- end
-
- def setup_path
- options[:setup_path] || "#{path_prefix}/#{name}/setup"
- end
-
- def current_path
- request.path_info.downcase.sub(/\/$/,'')
- end
-
- def query_string
- request.query_string.empty? ? "" : "?#{request.query_string}"
- end
-
- def call_through_to_app
- status, headers, body = *call_app!
- session['query_params'] = Rack::Request.new(env).params
- @response = Rack::Response.new(body, status, headers)
-
- status == 404 ? nil : @response.finish
- end
-
- def call_app!(env = @env)
- @app.call(env)
- end
-
- def auth_hash
- AuthHash.new(:provider => name.to_s)
- end
-
- def full_host
- case OmniAuth.config.full_host
- when String
- OmniAuth.config.full_host
- when Proc
- OmniAuth.config.full_host.call(env)
- else
- uri = URI.parse(request.url.gsub(/\?.*$/,''))
- uri.path = ''
- uri.query = nil
- uri.to_s
- end
- end
-
- def callback_url
- full_host + script_name + callback_path + query_string
- end
-
- def script_name
- @env['SCRIPT_NAME'] || ''
- end
-
- def session
- @env['rack.session']
- end
-
- def request
- @request ||= Rack::Request.new(@env)
- end
-
- def redirect(uri)
- r = Rack::Response.new
-
- if options[:iframe]
- r.write("<script type='text/javascript' charset='utf-8'>top.location.href = '#{uri}';</script>")
- else
- r.write("Redirecting to #{uri}...")
- r.redirect(uri)
- end
-
- r.finish
- end
-
- def user_info; {} end
-
- def fail!(message_key, exception = nil)
- self.env['omniauth.error'] = exception
- self.env['omniauth.error.type'] = message_key.to_sym
- self.env['omniauth.error.strategy'] = self
-
- OmniAuth.config.on_failure.call(self.env)
- end
- end
-end
View
12 oa-core/lib/omniauth/test.rb
@@ -1,12 +0,0 @@
-module OmniAuth
-
- # Support for testing OmniAuth strategies.
- module Test
-
- autoload :PhonySession, 'omniauth/test/phony_session'
- autoload :StrategyMacros, 'omniauth/test/strategy_macros'
- autoload :StrategyTestCase, 'omniauth/test/strategy_test_case'
-
- end
-
-end
View
8 oa-core/lib/omniauth/test/phony_session.rb
@@ -1,8 +0,0 @@
-class OmniAuth::Test::PhonySession
- def initialize(app); @app = app end
- def call(env)
- @session ||= (env['rack.session'] || {})
- env['rack.session'] = @session
- @app.call(env)
- end
-end
View
34 oa-core/lib/omniauth/test/strategy_macros.rb
@@ -1,34 +0,0 @@
-module OmniAuth
-
- module Test
-
- module StrategyMacros
-
- def sets_an_auth_hash
- it 'should set an auth hash' do
- last_request.env['omniauth.auth'].should be_kind_of(Hash)
- end
- end
-
- def sets_provider_to(provider)
- it "should set the provider to #{provider}" do
- (last_request.env['omniauth.auth'] || {})['provider'].should == provider
- end
- end
-
- def sets_uid_to(uid)
- it "should set the UID to #{uid}" do
- (last_request.env['omniauth.auth'] || {})['uid'].should == uid
- end
- end
-
- def sets_user_info_to(user_info)
- it "should set the user_info to #{user_info}" do
- (last_request.env['omniauth.auth'] || {})['user_info'].should == user_info
- end
- end
- end
-
- end
-
-end
View
49 oa-core/lib/omniauth/test/strategy_test_case.rb
@@ -1,49 +0,0 @@
-require 'rack'
-require 'omniauth/test'
-
-module OmniAuth
-
- module Test
-
- # Support for testing OmniAuth strategies.
- #
- # @example Usage
- # class MyStrategyTest < Test::Unit::TestCase
- # include OmniAuth::Test::StrategyTestCase
- # def strategy
- # # return the parameters to a Rack::Builder map call:
- # [MyStrategy.new, :some, :configuration, :options => 'here']
- # end
- # setup do
- # post '/auth/my_strategy/callback', :user => { 'name' => 'Dylan', 'id' => '445' }
- # end
- # end
- module StrategyTestCase
-
- def app
- strat = self.strategy
- resp = self.app_response
- Rack::Builder.new {
- use OmniAuth::Test::PhonySession
- use *strat
- run lambda {|env| [404, {'Content-Type' => 'text/plain'}, [resp || env.key?('omniauth.auth').to_s]] }
- }.to_app
- end
-
- def app_response
- nil
- end
-
- def session
- last_request.env['rack.session']
- end
-
- def strategy
- raise NotImplementedError.new('Including specs must define #strategy')
- end
-
- end
-
- end
-
-end
View
19 oa-core/lib/omniauth/version.rb
@@ -1,19 +0,0 @@
-module OmniAuth
- module Version
- unless defined?(::OmniAuth::Version::MAJOR)
- MAJOR = 0
- end
- unless defined?(::OmniAuth::Version::MINOR)
- MINOR = 3
- end
- unless defined?(::OmniAuth::Version::PATCH)
- PATCH = 0
- end
- unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc3"
- end
- unless defined?(::OmniAuth::Version::STRING)
- STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
- end
- end
-end
View
20 oa-core/spec/omniauth/builder_spec.rb
@@ -1,20 +0,0 @@
-require File.expand_path('../../spec_helper', __FILE__)
-
-describe OmniAuth::Builder do
- describe '#provider' do
- it 'should translate a symbol to a constant' do
- OmniAuth::Strategies.should_receive(:const_get).with('MyStrategy').and_return(Class.new)
- OmniAuth::Builder.new(nil) do
- provider :my_strategy
- end
- end
-
- it 'should also just accept a class' do
- class ::ExampleClass; end
-
- lambda{ OmniAuth::Builder.new(nil) do
- provider ::ExampleClass
- end }.should_not raise_error
- end
- end
-end
View
79 oa-core/spec/omniauth/core_spec.rb
@@ -1,79 +0,0 @@
-require File.expand_path('../../spec_helper', __FILE__)
-
-describe OmniAuth do
- describe '.strategies' do
- it 'should increase when a new strategy is made' do
- lambda{ class ExampleStrategy
- include OmniAuth::Strategy
- end }.should change(OmniAuth.strategies, :size).by(1)
- OmniAuth.strategies.last.should == ExampleStrategy
- end
- end
-
- context 'configuration' do
- it 'should be callable from .configure' do
- OmniAuth.configure do |c|
- c.should be_kind_of(OmniAuth::Configuration)
- end
- end
-
- before do
- @old_path_prefix = OmniAuth.config.path_prefix
- @old_on_failure = OmniAuth.config.on_failure
- end
-
- after do
- OmniAuth.configure do |config|
- config.path_prefix = @old_path_prefix
- config.on_failure = @old_on_failure
- end
- end
-
- it 'should be able to set the path' do
- OmniAuth.configure do |config|
- config.path_prefix = '/awesome'
- end
-
- OmniAuth.config.path_prefix.should == '/awesome'
- end
-
- it 'should be able to set the on_failure rack app' do
- OmniAuth.configure do |config|
- config.on_failure do
- 'yoyo'
- end
- end
-
- OmniAuth.config.on_failure.call.should == 'yoyo'
- end
- end
-
- describe '::Utils' do
- describe '.deep_merge' do
- it 'should combine hashes' do
- OmniAuth::Utils.deep_merge({'abc' => {'def' => 123}}, {'abc' => {'foo' => 'bar'}}).should == {
- 'abc' => {'def' => 123, 'foo' => 'bar'}
- }
- end
- end
-
- describe '.camelize' do
- it 'should work on normal cases' do
- {
- 'some_word' => 'SomeWord',
- 'AnotherWord' => 'AnotherWord',
- 'one' => 'One',
- 'three_words_now' => 'ThreeWordsNow'
- }.each_pair{ |k,v| OmniAuth::Utils.camelize(k).should == v }
- end
-
- it 'should work in special cases' do
- {
- 'oauth' => "OAuth",
- 'openid' => 'OpenID',
- 'open_id' => 'OpenID'
- }.each_pair{ |k,v| OmniAuth::Utils.camelize(k).should == v}
- end
- end
- end
-end
View
397 oa-core/spec/omniauth/strategy_spec.rb
@@ -1,397 +0,0 @@
-require File.expand_path('../../spec_helper', __FILE__)
-
-class ExampleStrategy
- include OmniAuth::Strategy
- def call(env); self.call!(env) end
- attr_reader :last_env
- def request_phase
- @fail = fail!(options[:failure]) if options[:failure]
- @last_env = env
- return @fail if @fail
- raise "Request Phase"
- end
- def callback_phase
- @fail = fail!(options[:failure]) if options[:failure]
- @last_env = env
- return @fail if @fail
- raise "Callback Phase"
- end
-end
-
-def make_env(path = '/auth/test', props = {})
- {
- 'REQUEST_METHOD' => 'GET',
- 'PATH_INFO' => path,
- 'rack.session' => {},
- 'rack.input' => StringIO.new('test=true')
- }.merge(props)
-end
-
-describe OmniAuth::Strategy do
- let(:app){ lambda{|env| [404, {}, ['Awesome']]}}
- describe '#initialize' do
- context 'options extraction' do
- it 'should be the last argument if the last argument is a Hash' do
- ExampleStrategy.new(app, 'test', :abc => 123).options[:abc].should == 123
- end
-
- it 'should be a blank hash if none are provided' do
- ExampleStrategy.new(app, 'test').options.should == {}
- end
- end
- end
-
- describe '#full_host' do
- let(:strategy){ ExampleStrategy.new(app, 'test', {}) }
- it 'should not freak out if there is a pipe in the URL' do
- strategy.call!(make_env('/whatever', 'rack.url_scheme' => 'http', 'SERVER_NAME' => 'facebook.lame', 'QUERY_STRING' => 'code=asofibasf|asoidnasd', 'SCRIPT_NAME' => '', 'SERVER_PORT' => 80))
- lambda{ strategy.full_host }.should_not raise_error
- end
- end
-
- describe '#call' do
- let(:strategy){ ExampleStrategy.new(app, 'test', @options) }
-
- context 'omniauth.origin' do
- it 'should be set on the request phase' do
- lambda{ strategy.call(make_env('/auth/test', 'HTTP_REFERER' => 'http://example.com/origin')) }.should raise_error("Request Phase")
- strategy.last_env['rack.session']['omniauth.origin'].should == 'http://example.com/origin'
- end
-
- it 'should be turned into an env variable on the callback phase' do
- lambda{ strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'})) }.should raise_error("Callback Phase")
- strategy.last_env['omniauth.origin'].should == 'http://example.com/origin'
- end
-
- it 'should set from the params if provided' do
- lambda{ strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'origin=/foo')) }.should raise_error('Request Phase')
- strategy.last_env['rack.session']['omniauth.origin'].should == '/foo'
- end
-
- it 'should be set on the failure env' do
- OmniAuth.config.should_receive(:on_failure).and_return(lambda{|env| env})
- @options = {:failure => :forced_fail}
- strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => '/awesome'}))
- end
-
- context "with script_name" do
- it 'should be set on the request phase, containing full path' do
- env = {'HTTP_REFERER' => 'http://example.com/sub_uri/origin', 'SCRIPT_NAME' => '/sub_uri' }
- lambda{ strategy.call(make_env('/auth/test', env)) }.should raise_error("Request Phase")
- strategy.last_env['rack.session']['omniauth.origin'].should == 'http://example.com/sub_uri/origin'
- end
-
- it 'should be turned into an env variable on the callback phase, containing full path' do
- env = {
- 'rack.session' => {'omniauth.origin' => 'http://example.com/sub_uri/origin'},
- 'SCRIPT_NAME' => '/sub_uri'
- }
-
- lambda{ strategy.call(make_env('/auth/test/callback', env)) }.should raise_error("Callback Phase")
- strategy.last_env['omniauth.origin'].should == 'http://example.com/sub_uri/origin'
- end
-
- end
- end
-
- context 'default paths' do
- it 'should use the default request path' do
- lambda{ strategy.call(make_env) }.should raise_error("Request Phase")
- end
-
- it 'should be case insensitive on request path' do
- lambda{ strategy.call(make_env('/AUTH/Test'))}.should raise_error("Request Phase")
- end
-
- it 'should be case insensitive on callback path' do
- lambda{ strategy.call(make_env('/AUTH/TeSt/CaLlBAck'))}.should raise_error("Callback Phase")
- end
-
- it 'should use the default callback path' do
- lambda{ strategy.call(make_env('/auth/test/callback')) }.should raise_error("Callback Phase")
- end
-
- it 'should strip trailing spaces on request' do
- lambda{ strategy.call(make_env('/auth/test/')) }.should raise_error("Request Phase")
- end
-
- it 'should strip trailing spaces on callback' do
- lambda{ strategy.call(make_env('/auth/test/callback/')) }.should raise_error("Callback Phase")
- end
-
- context 'callback_url' do
- it 'uses the default callback_path' do
- strategy.should_receive(:full_host).and_return('http://example.com')
-
- lambda{ strategy.call(make_env) }.should raise_error("Request Phase")
-
- strategy.callback_url.should == 'http://example.com/auth/test/callback'
- end
-
- it 'preserves the query parameters' do
- strategy.stub(:full_host).and_return('http://example.com')
- begin
- strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
- rescue RuntimeError; end
- strategy.callback_url.should == 'http://example.com/auth/test/callback?id=5'
- end
-
- it 'consider script name' do
- strategy.stub(:full_host).and_return('http://example.com')
- begin
- strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
- rescue RuntimeError; end
- strategy.callback_url.should == 'http://example.com/sub_uri/auth/test/callback'
- end
- end
- end
-
- context 'pre-request call through' do
- subject { ExampleStrategy.new(app, 'test') }
- let(:app){ lambda{|env| env['omniauth.boom'] = true; [env['test.status'] || 404, {}, ['Whatev']] } }
- it 'should be able to modify the env on the fly before the request_phase' do
- lambda{ subject.call(make_env) }.should raise_error("Request Phase")
- subject.response.status.should == 404
- subject.last_env.should be_key('omniauth.boom')
- end
-
- it 'should call through to the app instead if a non-404 response is received' do
- lambda{ subject.call(make_env('/auth/test', 'test.status' => 200)) }.should_not raise_error
- subject.response.body.should == ['Whatev']
- end
- end
-
- context 'custom paths' do
- it 'should use a custom request_path if one is provided' do
- @options = {:request_path => '/awesome'}
- lambda{ strategy.call(make_env('/awesome')) }.should raise_error("Request Phase")
- end
-
- it 'should use a custom callback_path if one is provided' do
- @options = {:callback_path => '/radical'}
- lambda{ strategy.call(make_env('/radical')) }.should raise_error("Callback Phase")
- end
-
- context 'callback_url' do
- it 'uses a custom callback_path if one is provided' do
- @options = {:callback_path => '/radical'}
- strategy.should_receive(:full_host).and_return('http://example.com')
-
- lambda{ strategy.call(make_env('/radical')) }.should raise_error("Callback Phase")
-
- strategy.callback_url.should == 'http://example.com/radical'
- end
-
- it 'preserves the query parameters' do
- @options = {:callback_path => '/radical'}
- strategy.stub(:full_host).and_return('http://example.com')
- begin
- strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
- rescue RuntimeError; end
- strategy.callback_url.should == 'http://example.com/radical?id=5'
- end
- end
- end
-
- context 'custom prefix' do
- before do
- @options = {:path_prefix => '/wowzers'}
- end
-
- it 'should use a custom prefix for request' do
- lambda{ strategy.call(make_env('/wowzers/test')) }.should raise_error("Request Phase")
- end
-
- it 'should use a custom prefix for callback' do
- lambda{ strategy.call(make_env('/wowzers/test/callback')) }.should raise_error("Callback Phase")
- end
-
- context 'callback_url' do
- it 'uses a custom prefix' do
- strategy.should_receive(:full_host).and_return('http://example.com')
-
- lambda{ strategy.call(make_env('/wowzers/test')) }.should raise_error("Request Phase")
-
- strategy.callback_url.should == 'http://example.com/wowzers/test/callback'
- end
-
- it 'preserves the query parameters' do
- strategy.stub(:full_host).and_return('http://example.com')
- begin
- strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'id=5'))
- rescue RuntimeError; end
- strategy.callback_url.should == 'http://example.com/wowzers/test/callback?id=5'
- end
- end
- end
-
- context 'request method restriction' do
- before do
- OmniAuth.config.allowed_request_methods = [:post]
- end
-
- it 'should not allow a request method of the wrong type' do
- lambda{ strategy.call(make_env)}.should_not raise_error
- end
-
- it 'should allow a request method of the correct type' do
- lambda{ strategy.call(make_env('/auth/test', 'REQUEST_METHOD' => 'POST'))}.should raise_error("Request Phase")
- end
-
- after do
- OmniAuth.config.allowed_request_methods = [:get, :post]
- end
- end
-
- context 'receiving an OPTIONS request' do
- shared_examples_for "an OPTIONS request" do
- it 'should respond with 200' do
- response[0].should == 200
- end
-
- it 'should set the Allow header properly' do
- response[1]['Allow'].should == "GET, POST"
- end
- end
-
- context 'to the request path' do
- let(:response) { strategy.call(make_env('/auth/test', 'REQUEST_METHOD' => 'OPTIONS')) }
- it_should_behave_like 'an OPTIONS request'
- end
-
- context 'to the request path' do
- let(:response) { strategy.call(make_env('/auth/test/callback', 'REQUEST_METHOD' => 'OPTIONS')) }
- it_should_behave_like 'an OPTIONS request'
- end
-
- context 'to some other path' do
- it 'should not short-circuit the request' do
- env = make_env('/other', 'REQUEST_METHOD' => 'OPTIONS')
- strategy.call(env).should == app.call(env)
- end
- end
- end
-
- context 'test mode' do
- before do
- OmniAuth.config.test_mode = true
- end
-
- it 'should short circuit the request phase entirely' do
- response = strategy.call(make_env)
- response[0].should == 302
- response[1]['Location'].should == '/auth/test/callback'
- end
-
- it 'should be case insensitive on request path' do
- strategy.call(make_env('/AUTH/Test'))[0].should == 302
- end
-
- it 'should respect SCRIPT_NAME (a.k.a. BaseURI)' do
- response = strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
- response[1]['Location'].should == '/sub_uri/auth/test/callback'
- end
-
- it 'should be case insensitive on callback path' do
- strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).should == strategy.call(make_env('/auth/test/callback'))
- end
-
- it 'should maintain query string parameters' do
- response = strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'cheese=stilton'))
- response[1]['Location'].should == '/auth/test/callback?cheese=stilton'
- end
-
- it 'should not short circuit requests outside of authentication' do
- strategy.call(make_env('/')).should == app.call(make_env('/'))
- end
-
- it 'should respond with the default hash if none is set' do
- strategy.call make_env('/auth/test/callback')
- strategy.env['omniauth.auth']['uid'].should == '1234'
- end
-
- it 'should respond with a provider-specific hash if one is set' do
- OmniAuth.config.mock_auth[:test] = {
- 'uid' => 'abc'
- }
-
- strategy.call make_env('/auth/test/callback')
- strategy.env['omniauth.auth']['uid'].should == 'abc'
- end
-
- it 'should simulate login failure if mocked data is set as a symbol' do
- OmniAuth.config.mock_auth[:test] = :invalid_credentials
-
- strategy.call make_env('/auth/test/callback')
- strategy.env['omniauth.error.type'].should == :invalid_credentials
- end
-
- it 'should set omniauth.origin on the request phase' do
- strategy.call(make_env('/auth/test', 'HTTP_REFERER' => 'http://example.com/origin'))
- strategy.env['rack.session']['omniauth.origin'].should == 'http://example.com/origin'
- end
-
- it 'should set omniauth.origin from the params if provided' do
- strategy.call(make_env('/auth/test', 'QUERY_STRING' => 'origin=/foo'))
- strategy.env['rack.session']['omniauth.origin'].should == '/foo'
- end
-
- it 'should turn omniauth.origin into an env variable on the callback phase' do
- OmniAuth.config.mock_auth[:test] = {}
-
- strategy.call(make_env('/auth/test/callback', 'rack.session' => {'omniauth.origin' => 'http://example.com/origin'}))
- strategy.env['omniauth.origin'].should == 'http://example.com/origin'
- end
- end
-
- context 'custom full_host' do
- it 'should be the string when a string is there' do
- OmniAuth.config.full_host = 'my.host.com'
- strategy.full_host.should == 'my.host.com'
- end
-
- it 'should run the proc with the env when it is a proc' do
- OmniAuth.config.full_host = Proc.new{|env| env['HOST']}
- strategy.call(make_env('/auth/test', 'HOST' => 'my.host.net'))
- strategy.full_host.should == 'my.host.net'
- end
- end
- end
-
- context 'setup phase' do
- context 'when options[:setup] = true' do
- let(:strategy){ ExampleStrategy.new(app, 'test', :setup => true) }
- let(:app){lambda{|env| env['omniauth.strategy'].options[:awesome] = 'sauce' if env['PATH_INFO'] == '/auth/test/setup'; [404, {}, 'Awesome'] }}
-
- it 'should call through to /auth/:provider/setup' do
- strategy.call(make_env('/auth/test'))
- strategy.options[:awesome].should == 'sauce'
- end
-
- it 'should not call through on a non-omniauth endpoint' do
- strategy.call(make_env('/somewhere/else'))
- strategy.options[:awesome].should_not == 'sauce'
- end
- end
-
- context 'when options[:setup] is an app' do
- let(:setup_proc) do
- Proc.new do |env|
- env['omniauth.strategy'].options[:awesome] = 'sauce'
- end
- end
-
- let(:strategy){ ExampleStrategy.new(app, 'test', :setup => setup_proc) }
-
- it 'should not call the app on a non-omniauth endpoint' do
- strategy.call(make_env('/somehwere/else'))
- strategy.options[:awesome].should_not == 'sauce'
- end
-
- it 'should call the rack app' do
- strategy.call(make_env('/auth/test'))
- strategy.options[:awesome].should == 'sauce'
- end
- end
- end
-end
View
12 oa-core/spec/spec_helper.rb
@@ -1,12 +0,0 @@
-require 'simplecov'
-SimpleCov.start
-require 'rspec'
-require 'rack/test'
-require 'omniauth/core'
-require 'omniauth/test'
-
-RSpec.configure do |config|
- config.include Rack::Test::Methods
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
-end
-
View
0  oa-enterprise/.gemtest
No changes.
View
3  oa-enterprise/.rspec
@@ -1,3 +0,0 @@
---color
---format=nested
---backtrace
View
4 oa-enterprise/.yardopts
@@ -1,4 +0,0 @@
---markup markdown
---markup-provider maruku
--
-LICENSE
View
11 oa-enterprise/Gemfile
@@ -1,11 +0,0 @@
-require File.expand_path('../lib/omniauth/version', __FILE__)
-
-source 'http://rubygems.org'
-
-gem 'oa-core', OmniAuth::Version::STRING, :path => '../oa-core'
-
-platforms :jruby do
- gem 'jruby-openssl', '~> 0.7'
-end
-
-gemspec
View
19 oa-enterprise/LICENSE
@@ -1,19 +0,0 @@
-Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
View
115 oa-enterprise/README.rdoc
@@ -1,115 +0,0 @@
-= OmniAuth::Enterprise
-
-OmniAuth strategies for use in your intranet.
-
-== Installation
-
-To get just enterprise functionality:
-
- gem install oa-enterprise
-
-For the full auth suite:
-
- gem install omniauth
-
-== CAS
-
-Use the CAS strategy as a middleware in your application:
-
- require 'omniauth/enterprise'
-
- use OmniAuth::Strategies::CAS, :server => 'http://cas.mycompany.com/cas'
-
-Then simply direct users to '/auth/cas' to have them sign in via your company's CAS server.
-See OmniAuth::Strategies::CAS::Configuration for more configuration options.
-
-== LDAP
-
-Use the LDAP strategy as a middleware in your application:
-
- require 'omniauth/enterprise'
- use OmniAuth::Strategies::LDAP,
- :title => "My LDAP",
- :host => '10.101.10.1',
- :port => 389,
- :method => :plain,
- :base => 'dc=intridea, dc=com',
- :uid => 'sAMAccountName',
- :name_proc => Proc.new {|name| name.gsub(/@.*$/,'')}
- :bind_dn => 'default_bind_dn'
- :password => 'password'
-
-All of the listed options are required, with the exception of :name_proc, :bind_dn, and :password
-Allowed values of :method are: :plain, :ssl, :tls.
-
-:bind_dn and :password are used to perform the initial binding if user lookup is
-needed. If the user lookup returns result, the DN attribute from the result set is used
-to perform the final binding. This is needed only when the LDAP server requires
-DN to be used for binding and you may only want user to using email or username
-in the login form.
-
-:uid is the LDAP attribute name for the user name in the login form. typically
-AD would be 'sAMAccountName' or 'UserPrincipalName', while OpenLDAP is 'uid'.
-You can also use 'dn', if your user choose the put in the dn in the login form
-(but usually is too long for user to remember or know).
-
-:name_proc allows you to match the user name entered with the format of the
-:uid attributes. For example, value of 'sAMAccountName' in AD contains only the
-windows user name. If your user prefers use email to login, a name_proc as
-above will trim the email string down to just the windows name. In summary,
-:name_proc helps you to fill the gap between the authentication and user lookup
-process.
-
-:try_sasl and :sasl_mechanisms are optional. Use them to initialize a SASL
-connection to server. Allowed values are 'DIGEST-MD5' and 'GSS-SPNEGO'. If you
-are not familiar with these authentication methods, please just avoid them.
-
-Direct users to '/auth/ldap' to have them authenticated via your
-company's LDAP server.
-
-== SAML
-
-Use the SAML strategy as a middleware in your application:
-
- require 'omniauth/enterprise'
- use OmniAuth::Strategies::SAML,
- :assertion_consumer_service_url => "consumer_service_url",
- :issuer => "issuer",
- :idp_sso_target_url => "idp_sso_target_url",
- :idp_cert_fingerprint => "E7:91:B2:E1:...",
- :name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
-
-:assertion_consumer_service_url
- The URL at which the SAML assertion should be received.
-
-:issuer
- The name of your application. Some identity providers might need this to establish the
- identity of the service provider requesting the login.
-
-:idp_sso_target_url
- The URL to which the authentication request should be sent. This would be on the identity provider.
-
-:idp_cert_fingerprint
- The certificate fingerprint, e.g. "90:CC:16:F0:8D:A6:D1:C6:BB:27:2D:BA:93:80:1A:1F:16:8E:4E:08".
- This is provided from the identity provider when setting up the relationship.
-
-:name_identifier_format
- Describes the format of the username required by this application.
- If you need the email address, use "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress".
- See http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf section 8.3 for
- other options. Note that the identity provider might not support all options.
-
-
-== Multiple Strategies
-
-If you're using multiple strategies together, use OmniAuth's Builder. That's
-what it's there for:
-
- require 'omniauth/enterprise'
- require 'omniauth/oauth' # for Campfire
- require 'openid/store/filesystem'
-
- use OmniAuth::Builder do
- provider :cas, :server => 'http://cas.mycompany.com/cas'
- provider :campfire
- end
View
6 oa-enterprise/Rakefile
@@ -1,6 +0,0 @@
-require 'bundler'
-Bundler::GemHelper.install_tasks
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec)
-task :default => :spec
-task :test => :spec
View
1  oa-enterprise/lib/oa-enterprise.rb
@@ -1 +0,0 @@
-require 'omniauth/enterprise'
View
9 oa-enterprise/lib/omniauth/enterprise.rb
@@ -1,9 +0,0 @@
-require 'omniauth/core'
-
-module OmniAuth
- module Strategies
- autoload :CAS, 'omniauth/strategies/cas'
- autoload :LDAP, 'omniauth/strategies/ldap'
- autoload :SAML, 'omniauth/strategies/saml'
- end
-end
View
47 oa-enterprise/lib/omniauth/strategies/cas.rb
@@ -1,47 +0,0 @@
-require 'omniauth/enterprise'
-
-module OmniAuth
- module Strategies
- class CAS
- include OmniAuth::Strategy
-
- autoload :Configuration, 'omniauth/strategies/cas/configuration'
- autoload :ServiceTicketValidator, 'omniauth/strategies/cas/service_ticket_validator'
-
- def initialize(app, options = {}, &block)
- super(app, options[:name] || :cas, options.dup, &block)
- @configuration = OmniAuth::Strategies::CAS::Configuration.new(options)
- end
-
- protected
-
- def request_phase
- [
- 302,
- {
- 'Location' => @configuration.login_url(callback_url),
- 'Content-Type' => 'text/plain'
- },
- ["You are being redirected to CAS for sign-in."]
- ]
- end
-
- def callback_phase
- ticket = request.params['ticket']
- return fail!(:no_ticket, 'No CAS Ticket') unless ticket
- validator = ServiceTicketValidator.new(@configuration, callback_url, ticket)
- @user_info = validator.user_info
- return fail!(:invalid_ticket, 'Invalid CAS Ticket') if @user_info.nil? || @user_info.empty?
- super
- end
-
- def auth_hash
- OmniAuth::Utils.deep_merge(super, {
- 'uid' => @user_info.delete('user'),
- 'extra' => @user_info
- })
- end
-
- end
- end
-end
View
98 oa-enterprise/lib/omniauth/strategies/cas/configuration.rb
@@ -1,98 +0,0 @@
-require 'rack'
-
-module OmniAuth
- module Strategies
- class CAS
- class Configuration
-
- DEFAULT_LOGIN_URL = "%s/login"
-
- DEFAULT_SERVICE_VALIDATE_URL = "%s/serviceValidate"
-
- # @param [Hash] params configuration options
- # @option params [String, nil] :cas_server the CAS server root URL; probably something like
- # `http://cas.mycompany.com` or `http://cas.mycompany.com/cas`; optional.
- # @option params [String, nil] :cas_login_url (:cas_server + '/login') the URL to which to
- # redirect for logins; options if `:cas_server` is specified,
- # required otherwise.
- # @option params [String, nil] :cas_service_validate_url (:cas_server + '/serviceValidate') the
- # URL to use for validating service tickets; optional if `:cas_server` is
- # specified, requred otherwise.
- # @option params [Boolean, nil] :disable_ssl_verification disable verification for SSL cert,
- # helpful when you developing with a fake cert.
- def initialize(params)
- parse_params params
- end