omniauth 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. data/README.md +62 -34
  2. data/lib/omniauth/version.rb +2 -2
  3. metadata +59 -225
  4. data/.autotest +0 -9
  5. data/.document +0 -5
  6. data/.gemtest +0 -0
  7. data/.gitignore +0 -56
  8. data/.rspec +0 -2
  9. data/.travis.yml +0 -9
  10. data/.yardopts +0 -4
  11. data/Gemfile +0 -12
  12. data/Rakefile +0 -51
  13. data/oa-basic/.gemtest +0 -0
  14. data/oa-basic/.rspec +0 -3
  15. data/oa-basic/.yardopts +0 -4
  16. data/oa-basic/Gemfile +0 -7
  17. data/oa-basic/LICENSE +0 -19
  18. data/oa-basic/README.rdoc +0 -34
  19. data/oa-basic/Rakefile +0 -6
  20. data/oa-basic/lib/oa-basic.rb +0 -1
  21. data/oa-basic/lib/omniauth/basic.rb +0 -8
  22. data/oa-basic/lib/omniauth/strategies/http_basic.rb +0 -56
  23. data/oa-basic/lib/omniauth/version.rb +0 -19
  24. data/oa-basic/oa-basic.gemspec +0 -27
  25. data/oa-basic/spec/omniauth/strategies/basic_spec.rb +0 -7
  26. data/oa-basic/spec/spec_helper.rb +0 -11
  27. data/oa-core/.gemtest +0 -0
  28. data/oa-core/.rspec +0 -3
  29. data/oa-core/.yardopts +0 -4
  30. data/oa-core/Gemfile +0 -3
  31. data/oa-core/LICENSE +0 -19
  32. data/oa-core/Rakefile +0 -6
  33. data/oa-core/autotest/discover.rb +0 -1
  34. data/oa-core/lib/oa-core.rb +0 -1
  35. data/oa-core/lib/omniauth/builder.rb +0 -33
  36. data/oa-core/lib/omniauth/core.rb +0 -135
  37. data/oa-core/lib/omniauth/form.rb +0 -186
  38. data/oa-core/lib/omniauth/strategy.rb +0 -227
  39. data/oa-core/lib/omniauth/test/phony_session.rb +0 -8
  40. data/oa-core/lib/omniauth/test/strategy_macros.rb +0 -34
  41. data/oa-core/lib/omniauth/test/strategy_test_case.rb +0 -49
  42. data/oa-core/lib/omniauth/test.rb +0 -12
  43. data/oa-core/lib/omniauth/version.rb +0 -19
  44. data/oa-core/oa-core.gemspec +0 -24
  45. data/oa-core/spec/omniauth/builder_spec.rb +0 -20
  46. data/oa-core/spec/omniauth/core_spec.rb +0 -79
  47. data/oa-core/spec/omniauth/strategy_spec.rb +0 -363
  48. data/oa-core/spec/spec_helper.rb +0 -12
  49. data/oa-enterprise/.gemtest +0 -0
  50. data/oa-enterprise/.rspec +0 -3
  51. data/oa-enterprise/.yardopts +0 -4
  52. data/oa-enterprise/Gemfile +0 -7
  53. data/oa-enterprise/LICENSE +0 -19
  54. data/oa-enterprise/README.rdoc +0 -82
  55. data/oa-enterprise/Rakefile +0 -6
  56. data/oa-enterprise/lib/oa-enterprise.rb +0 -1
  57. data/oa-enterprise/lib/omniauth/enterprise.rb +0 -8
  58. data/oa-enterprise/lib/omniauth/strategies/cas/configuration.rb +0 -98
  59. data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +0 -91
  60. data/oa-enterprise/lib/omniauth/strategies/cas.rb +0 -47
  61. data/oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb +0 -279
  62. data/oa-enterprise/lib/omniauth/strategies/ldap.rb +0 -111
  63. data/oa-enterprise/lib/omniauth/version.rb +0 -19
  64. data/oa-enterprise/oa-enterprise.gemspec +0 -31
  65. data/oa-enterprise/spec/fixtures/cas_failure.xml +0 -4
  66. data/oa-enterprise/spec/fixtures/cas_success.xml +0 -8
  67. data/oa-enterprise/spec/omniauth/strategies/cas_spec.rb +0 -94
  68. data/oa-enterprise/spec/omniauth/strategies/ldap_spec.rb +0 -41
  69. data/oa-enterprise/spec/spec_helper.rb +0 -14
  70. data/oa-more/.gemtest +0 -0
  71. data/oa-more/.rspec +0 -3
  72. data/oa-more/.yardopts +0 -4
  73. data/oa-more/Gemfile +0 -7
  74. data/oa-more/LICENSE +0 -19
  75. data/oa-more/README.rdoc +0 -22
  76. data/oa-more/Rakefile +0 -6
  77. data/oa-more/lib/oa-more.rb +0 -1
  78. data/oa-more/lib/omniauth/more.rb +0 -11
  79. data/oa-more/lib/omniauth/strategies/draugiem.rb +0 -104
  80. data/oa-more/lib/omniauth/strategies/flickr.rb +0 -86
  81. data/oa-more/lib/omniauth/strategies/ign.rb +0 -93
  82. data/oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb +0 -1143
  83. data/oa-more/lib/omniauth/strategies/windows_live.rb +0 -39
  84. data/oa-more/lib/omniauth/strategies/yupoo.rb +0 -67
  85. data/oa-more/lib/omniauth/version.rb +0 -19
  86. data/oa-more/oa-more.gemspec +0 -29
  87. data/oa-more/spec/omniauth/strategies/draugiem_spec.rb +0 -51
  88. data/oa-more/spec/omniauth/strategies/flickr_spec.rb +0 -7
  89. data/oa-more/spec/spec_helper.rb +0 -11
  90. data/oa-oauth/.gemtest +0 -0
  91. data/oa-oauth/.rspec +0 -3
  92. data/oa-oauth/.yardopts +0 -4
  93. data/oa-oauth/Gemfile +0 -7
  94. data/oa-oauth/LICENSE +0 -19
  95. data/oa-oauth/README.rdoc +0 -35
  96. data/oa-oauth/Rakefile +0 -6
  97. data/oa-oauth/autotest/discover.rb +0 -1
  98. data/oa-oauth/lib/oa-oauth.rb +0 -1
  99. data/oa-oauth/lib/omniauth/oauth.rb +0 -56
  100. data/oa-oauth/lib/omniauth/strategies/bitly.rb +0 -46
  101. data/oa-oauth/lib/omniauth/strategies/dailymile.rb +0 -64
  102. data/oa-oauth/lib/omniauth/strategies/doit.rb +0 -60
  103. data/oa-oauth/lib/omniauth/strategies/dopplr.rb +0 -53
  104. data/oa-oauth/lib/omniauth/strategies/douban.rb +0 -60
  105. data/oa-oauth/lib/omniauth/strategies/evernote.rb +0 -54
  106. data/oa-oauth/lib/omniauth/strategies/facebook.rb +0 -70
  107. data/oa-oauth/lib/omniauth/strategies/foursquare.rb +0 -62
  108. data/oa-oauth/lib/omniauth/strategies/github.rb +0 -50
  109. data/oa-oauth/lib/omniauth/strategies/goodreads.rb +0 -44
  110. data/oa-oauth/lib/omniauth/strategies/google.rb +0 -80
  111. data/oa-oauth/lib/omniauth/strategies/gowalla.rb +0 -72
  112. data/oa-oauth/lib/omniauth/strategies/hyves.rb +0 -67
  113. data/oa-oauth/lib/omniauth/strategies/identica.rb +0 -49
  114. data/oa-oauth/lib/omniauth/strategies/instagram.rb +0 -56
  115. data/oa-oauth/lib/omniauth/strategies/instapaper.rb +0 -40
  116. data/oa-oauth/lib/omniauth/strategies/linked_in.rb +0 -56
  117. data/oa-oauth/lib/omniauth/strategies/mailru.rb +0 -107
  118. data/oa-oauth/lib/omniauth/strategies/meetup.rb +0 -56
  119. data/oa-oauth/lib/omniauth/strategies/miso.rb +0 -41
  120. data/oa-oauth/lib/omniauth/strategies/mixi.rb +0 -59
  121. data/oa-oauth/lib/omniauth/strategies/netflix.rb +0 -65
  122. data/oa-oauth/lib/omniauth/strategies/oauth.rb +0 -83
  123. data/oa-oauth/lib/omniauth/strategies/oauth2.rb +0 -91
  124. data/oa-oauth/lib/omniauth/strategies/plurk.rb +0 -58
  125. data/oa-oauth/lib/omniauth/strategies/qzone.rb +0 -69
  126. data/oa-oauth/lib/omniauth/strategies/rdio.rb +0 -45
  127. data/oa-oauth/lib/omniauth/strategies/renren.rb +0 -87
  128. data/oa-oauth/lib/omniauth/strategies/salesforce.rb +0 -44
  129. data/oa-oauth/lib/omniauth/strategies/smug_mug.rb +0 -42
  130. data/oa-oauth/lib/omniauth/strategies/sound_cloud.rb +0 -46
  131. data/oa-oauth/lib/omniauth/strategies/t163.rb +0 -57
  132. data/oa-oauth/lib/omniauth/strategies/taobao.rb +0 -79
  133. data/oa-oauth/lib/omniauth/strategies/teambox.rb +0 -49
  134. data/oa-oauth/lib/omniauth/strategies/thirty_seven_signals.rb +0 -41
  135. data/oa-oauth/lib/omniauth/strategies/tqq.rb +0 -64
  136. data/oa-oauth/lib/omniauth/strategies/trade_me.rb +0 -45
  137. data/oa-oauth/lib/omniauth/strategies/trip_it.rb +0 -22
  138. data/oa-oauth/lib/omniauth/strategies/tsina.rb +0 -79
  139. data/oa-oauth/lib/omniauth/strategies/tsohu.rb +0 -57
  140. data/oa-oauth/lib/omniauth/strategies/tumblr.rb +0 -60
  141. data/oa-oauth/lib/omniauth/strategies/twitter.rb +0 -57
  142. data/oa-oauth/lib/omniauth/strategies/type_pad.rb +0 -76
  143. data/oa-oauth/lib/omniauth/strategies/vimeo.rb +0 -54
  144. data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +0 -87
  145. data/oa-oauth/lib/omniauth/strategies/xauth.rb +0 -67
  146. data/oa-oauth/lib/omniauth/strategies/yahoo.rb +0 -55
  147. data/oa-oauth/lib/omniauth/strategies/yammer.rb +0 -43
  148. data/oa-oauth/lib/omniauth/strategies/you_tube.rb +0 -73
  149. data/oa-oauth/lib/omniauth/version.rb +0 -19
  150. data/oa-oauth/oa-oauth.gemspec +0 -32
  151. data/oa-oauth/spec/fixtures/basecamp_200.xml +0 -24
  152. data/oa-oauth/spec/fixtures/campfire_200.json +0 -10
  153. data/oa-oauth/spec/omniauth/strategies/bitly_spec.rb +0 -5
  154. data/oa-oauth/spec/omniauth/strategies/dailymile_spec.rb +0 -5
  155. data/oa-oauth/spec/omniauth/strategies/doit_spec.rb +0 -5
  156. data/oa-oauth/spec/omniauth/strategies/dopplr_spec.rb +0 -5
  157. data/oa-oauth/spec/omniauth/strategies/douban_spec.rb +0 -5
  158. data/oa-oauth/spec/omniauth/strategies/evernote_spec.rb +0 -5
  159. data/oa-oauth/spec/omniauth/strategies/facebook_spec.rb +0 -5
  160. data/oa-oauth/spec/omniauth/strategies/foursquare_spec.rb +0 -18
  161. data/oa-oauth/spec/omniauth/strategies/github_spec.rb +0 -5
  162. data/oa-oauth/spec/omniauth/strategies/goodreads_spec.rb +0 -6
  163. data/oa-oauth/spec/omniauth/strategies/google_spec.rb +0 -5
  164. data/oa-oauth/spec/omniauth/strategies/gowalla_spec.rb +0 -5
  165. data/oa-oauth/spec/omniauth/strategies/hyves_spec.rb +0 -5
  166. data/oa-oauth/spec/omniauth/strategies/identica_spec.rb +0 -5
  167. data/oa-oauth/spec/omniauth/strategies/linked_in_spec.rb +0 -5
  168. data/oa-oauth/spec/omniauth/strategies/mailru_spec.rb +0 -5
  169. data/oa-oauth/spec/omniauth/strategies/meetup_spec.rb +0 -14
  170. data/oa-oauth/spec/omniauth/strategies/miso_spec.rb +0 -5
  171. data/oa-oauth/spec/omniauth/strategies/netflix_spec.rb +0 -5
  172. data/oa-oauth/spec/omniauth/strategies/oauth2_spec.rb +0 -0
  173. data/oa-oauth/spec/omniauth/strategies/oauth_spec.rb +0 -77
  174. data/oa-oauth/spec/omniauth/strategies/plurk_spec.rb +0 -5
  175. data/oa-oauth/spec/omniauth/strategies/rdio_spec.rb +0 -5
  176. data/oa-oauth/spec/omniauth/strategies/salesforce_spec.rb +0 -5
  177. data/oa-oauth/spec/omniauth/strategies/smug_mug_spec.rb +0 -5
  178. data/oa-oauth/spec/omniauth/strategies/sound_cloud_spec.rb +0 -5
  179. data/oa-oauth/spec/omniauth/strategies/t163_spec.rb +0 -5
  180. data/oa-oauth/spec/omniauth/strategies/taobao_spec.rb +0 -5
  181. data/oa-oauth/spec/omniauth/strategies/teambox_spec.rb +0 -5
  182. data/oa-oauth/spec/omniauth/strategies/thirty_seven_signals_spec.rb +0 -5
  183. data/oa-oauth/spec/omniauth/strategies/trade_me_spec.rb +0 -5
  184. data/oa-oauth/spec/omniauth/strategies/trip_it_spec.rb +0 -5
  185. data/oa-oauth/spec/omniauth/strategies/tsina_spec.rb +0 -5
  186. data/oa-oauth/spec/omniauth/strategies/tumblr_spec.rb +0 -5
  187. data/oa-oauth/spec/omniauth/strategies/twitter_spec.rb +0 -20
  188. data/oa-oauth/spec/omniauth/strategies/type_pad_spec.rb +0 -5
  189. data/oa-oauth/spec/omniauth/strategies/vimeo_spec.rb +0 -5
  190. data/oa-oauth/spec/omniauth/strategies/vkontakte_spec.rb +0 -5
  191. data/oa-oauth/spec/omniauth/strategies/yahoo_spec.rb +0 -5
  192. data/oa-oauth/spec/omniauth/strategies/yammer_spec.rb +0 -5
  193. data/oa-oauth/spec/omniauth/strategies/you_tube_spec.rb +0 -5
  194. data/oa-oauth/spec/spec_helper.rb +0 -27
  195. data/oa-oauth/spec/support/shared_examples.rb +0 -29
  196. data/oa-openid/.gemtest +0 -0
  197. data/oa-openid/.rspec +0 -3
  198. data/oa-openid/.yardopts +0 -4
  199. data/oa-openid/Gemfile +0 -7
  200. data/oa-openid/LICENSE +0 -19
  201. data/oa-openid/README.rdoc +0 -51
  202. data/oa-openid/Rakefile +0 -6
  203. data/oa-openid/lib/oa-openid.rb +0 -1
  204. data/oa-openid/lib/omniauth/openid/gapps.rb +0 -32
  205. data/oa-openid/lib/omniauth/openid.rb +0 -60
  206. data/oa-openid/lib/omniauth/strategies/google_apps.rb +0 -23
  207. data/oa-openid/lib/omniauth/strategies/open_id.rb +0 -132
  208. data/oa-openid/lib/omniauth/strategies/steam.rb +0 -55
  209. data/oa-openid/lib/omniauth/version.rb +0 -19
  210. data/oa-openid/oa-openid.gemspec +0 -28
  211. data/oa-openid/spec/omniauth/strategies/open_id_spec.rb +0 -71
  212. data/oa-openid/spec/spec_helper.rb +0 -14
  213. data/omniauth.gemspec +0 -20
  214. data/tasks/all.rb +0 -134
data/oa-openid/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,51 +0,0 @@
1
- = OmniAuth::OpenID
2
-
3
- Provides strategies for authenticating to providers using the OpenID standard.
4
-
5
- == Installation
6
-
7
- To get just OpenID functionality:
8
-
9
- gem install oa-openid
10
-
11
- For the full auth suite:
12
-
13
- gem install omniauth
14
-
15
- == Stand-Alone Example
16
-
17
- Use the strategy as a middleware in your application:
18
-
19
- require 'omniauth/openid'
20
- require 'openid/store/filesystem'
21
-
22
- use Rack::Session::Cookie
23
- use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp')
24
-
25
- Then simply direct users to '/auth/open_id' to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an <tt>identifier</tt> parameter to the URL (Example: <tt>/auth/open_id?openid_url=yahoo.com</tt>).
26
-
27
- A list of all OpenID stores is available at http://github.com/openid/ruby-openid/tree/master/lib/openid/store/
28
-
29
- == OmniAuth Builder
30
-
31
- If OpenID is one of several authentication strategies, use the OmniAuth Builder:
32
-
33
- require 'omniauth/openid'
34
- require 'omniauth/basic' # for Campfire
35
- require 'openid/store/filesystem'
36
-
37
- use OmniAuth::Builder do
38
- provider :open_id, OpenID::Store::Filesystem.new('/tmp')
39
- provider :campfire
40
- end
41
-
42
- == Configured Identifiers
43
-
44
- You may pre-configure an OpenID identifier. For example, to use Google's main OpenID endpoint:
45
-
46
- use OmniAuth::Builder do
47
- provider :open_id, nil, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
48
- end
49
-
50
- Note the use of nil, which will trigger ruby-openid's default Memory Store.
51
-
data/oa-openid/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
- require 'rspec/core/rake_task'
4
- RSpec::Core::RakeTask.new(:spec)
5
- task :default => :spec
6
- task :test => :spec
@@ -1 +0,0 @@
1
- require 'omniauth/openid'
@@ -1,32 +0,0 @@
1
- require 'openid/consumer'
2
- require 'gapps_openid'
3
-
4
- module OpenID
5
- # Because gapps_openid changes the discovery order
6
- # (looking first for Google Apps, then anything else),
7
- # we need to monkeypatch it to make it play nicely
8
- # with others.
9
- def self.discover(uri)
10
- discovered = self.default_discover(uri)
11
-
12
- if discovered.last.empty?
13
- info = discover_google_apps(uri)
14
- return info if info
15
- end
16
-
17
- return discovered
18
- rescue OpenID::DiscoveryFailure => e
19
- info = discover_google_apps(uri)
20
-
21
- if info.nil?
22
- raise e
23
- else
24
- return info
25
- end
26
- end
27
-
28
- def self.discover_google_apps(uri)
29
- discovery = GoogleDiscovery.new
30
- discovery.perform_discovery(uri)
31
- end
32
- end
@@ -1,60 +0,0 @@
1
- require 'omniauth/core'
2
-
3
- module OmniAuth
4
- # OmniAuth::OpenID provides strategies for authenticating to providers
5
- # using the OpenID standard.
6
- #
7
- # # Installation
8
- #
9
- # To get just OpenID functionality:
10
- #
11
- # gem install oa-openid
12
- #
13
- # For the full auth suite:
14
- #
15
- # gem install omniauth
16
- #
17
- # # Stand-Alone Example
18
- #
19
- # Use the strategy as a middleware in your application:
20
- #
21
- # require 'omniauth/openid'
22
- # require 'openid/store/filesystem'
23
- #
24
- # use Rack::Session::Cookie
25
- # use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp')
26
- #
27
- # Then simply direct users to '/auth/open_id' to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an <tt>identifier</tt> parameter to the URL (Example: <tt>/auth/open_id?openid_url=yahoo.com</tt>).
28
- #
29
- # A list of all OpenID stores is available at http://github.com/openid/ruby-openid/tree/master/lib/openid/store/
30
- #
31
- # # OmniAuth Builder
32
- #
33
- # If OpenID is one of several authentication strategies, use the OmniAuth Builder:
34
- #
35
- # require 'omniauth/openid'
36
- # require 'omniauth/basic' # for Campfire
37
- # require 'openid/store/filesystem'
38
- #
39
- # use OmniAuth::Builder do
40
- # provider :open_id, OpenID::Store::Filesystem.new('/tmp')
41
- # provider :campfire
42
- # end
43
- #
44
- # # Configured Identifiers
45
- #
46
- # You may pre-configure an OpenID identifier. For example, to use Google's main OpenID endpoint:
47
- #
48
- # use OmniAuth::Builder do
49
- # provider :open_id, nil, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
50
- # end
51
- #
52
- # Note the use of nil, which will trigger ruby-openid's default Memory Store.
53
- module OpenID; end
54
-
55
- module Strategies
56
- autoload :OpenID, 'omniauth/strategies/open_id'
57
- autoload :GoogleApps, 'omniauth/strategies/google_apps'
58
- autoload :Steam, 'omniauth/strategies/steam'
59
- end
60
- end
@@ -1,23 +0,0 @@
1
- require 'omniauth/openid'
2
-
3
- module OmniAuth
4
- module Strategies
5
- class GoogleApps < OmniAuth::Strategies::OpenID
6
- def initialize(app, store = nil, options = {}, &block)
7
- options[:name] ||= 'google_apps'
8
- super(app, store, options, &block)
9
- end
10
-
11
- def get_identifier
12
- OmniAuth::Form.build(:title => 'Google Apps Authentication') do
13
- label_field('Google Apps Domain', 'domain')
14
- input_field('url', 'domain')
15
- end.to_response
16
- end
17
-
18
- def identifier
19
- options[:domain] || request['domain']
20
- end
21
- end
22
- end
23
- end
@@ -1,132 +0,0 @@
1
- require 'rack/openid'
2
- require 'omniauth/openid/gapps'
3
- require 'omniauth/openid'
4
-
5
- module OmniAuth
6
- module Strategies
7
- # OmniAuth strategy for connecting via OpenID. This allows for connection
8
- # to a wide variety of sites, some of which are listed [on the OpenID website](http://openid.net/get-an-openid/).
9
- class OpenID
10
- include OmniAuth::Strategy
11
-
12
- attr_accessor :options
13
-
14
- IDENTIFIER_URL_PARAMETER = 'openid_url'
15
-
16
- AX = {
17
- :email => 'http://axschema.org/contact/email',
18
- :name => 'http://axschema.org/namePerson',
19
- :nickname => 'http://axschema.org/namePerson/friendly',
20
- :first_name => 'http://axschema.org/namePerson/first',
21
- :last_name => 'http://axschema.org/namePerson/last',
22
- :city => 'http://axschema.org/contact/city/home',
23
- :state => 'http://axschema.org/contact/state/home',
24
- :website => 'http://axschema.org/contact/web/default',
25
- :image => 'http://axschema.org/media/image/aspect11'
26
- }
27
-
28
- # Initialize the strategy as a Rack Middleware.
29
- #
30
- # @param app [Rack Application] Standard Rack middleware application argument.
31
- # @param store [OpenID Store] The [OpenID Store](http://github.com/openid/ruby-openid/tree/master/lib/openid/store/)
32
- # you wish to use. Defaults to OpenID::MemoryStore.
33
- # @option options [Array] :required The identity fields that are required for the OpenID
34
- # request. May be an ActiveExchange schema URL or an sreg identifier.
35
- # @option options [Array] :optional The optional attributes for the OpenID request. May
36
- # be ActiveExchange or sreg.
37
- # @option options [Symbol, :open_id] :name The URL segment name for this provider.
38
- def initialize(app, store = nil, options = {}, &block)
39
- super(app, (options[:name] || :open_id), &block)
40
- @options = options
41
- @options[:required] ||= [AX[:email], AX[:name], AX[:first_name], AX[:last_name], 'email', 'fullname']
42
- @options[:optional] ||= [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname']
43
- @store = store
44
- end
45
-
46
- protected
47
-
48
- def dummy_app
49
- lambda{|env| [401, {"WWW-Authenticate" => Rack::OpenID.build_header(
50
- :identifier => identifier,
51
- :return_to => callback_url,
52
- :required => @options[:required],
53
- :optional => @options[:optional],
54
- :method => 'post'
55
- )}, []]}
56
- end
57
-
58
- def identifier
59
- options[:identifier] || request[IDENTIFIER_URL_PARAMETER]
60
- end
61
-
62
- def request_phase
63
- identifier ? start : get_identifier
64
- end
65
-
66
- def start
67
- openid = Rack::OpenID.new(dummy_app, @store)
68
- response = openid.call(env)
69
- case env['rack.openid.response']
70
- when Rack::OpenID::MissingResponse, Rack::OpenID::TimeoutResponse
71
- fail!(:connection_failed)
72
- else
73
- response
74
- end
75
- end
76
-
77
- def get_identifier
78
- OmniAuth::Form.build(:title => 'OpenID Authentication') do
79
- label_field('OpenID Identifier', IDENTIFIER_URL_PARAMETER)
80
- input_field('url', IDENTIFIER_URL_PARAMETER)
81
- end.to_response
82
- end
83
-
84
- def callback_phase
85
- openid = Rack::OpenID.new(lambda{|env| [200,{},[]]}, @store)
86
- openid.call(env)
87
- @openid_response = env.delete('rack.openid.response')
88
- if @openid_response && @openid_response.status == :success
89
- super
90
- else
91
- fail!(:invalid_credentials)
92
- end
93
- end
94
-
95
- def auth_hash
96
- OmniAuth::Utils.deep_merge(super(), {
97
- 'uid' => @openid_response.display_identifier,
98
- 'user_info' => user_info(@openid_response)
99
- })
100
- end
101
-
102
- def user_info(response)
103
- sreg_user_info(response).merge(ax_user_info(response))
104
- end
105
-
106
- def sreg_user_info(response)
107
- sreg = ::OpenID::SReg::Response.from_success_response(response)
108
- return {} unless sreg
109
- {
110
- 'email' => sreg['email'],
111
- 'name' => sreg['fullname'],
112
- 'location' => sreg['postcode'],
113
- 'nickname' => sreg['nickname']
114
- }.reject{|k,v| v.nil? || v == ''}
115
- end
116
-
117
- def ax_user_info(response)
118
- ax = ::OpenID::AX::FetchResponse.from_success_response(response)
119
- return {} unless ax
120
- {
121
- 'email' => ax.get_single(AX[:email]),
122
- 'first_name' => ax.get_single(AX[:first_name]),
123
- 'last_name' => ax.get_single(AX[:last_name]),
124
- 'name' => (ax.get_single(AX[:name]) || [ax.get_single(AX[:first_name]), ax.get_single(AX[:last_name])].join(' ')).strip,
125
- 'location' => ("#{ax.get_single(AX[:city])}, #{ax.get_single(AX[:state])}" if Array(ax.get_single(AX[:city])).any? && Array(ax.get_single(AX[:state])).any?),
126
- 'nickname' => ax.get_single(AX[:nickname]),
127
- 'urls' => ({'Website' => Array(ax.get_single(AX[:website])).first} if Array(ax.get_single(AX[:website])).any?)
128
- }.inject({}){|h,(k,v)| h[k] = Array(v).first; h}.reject{|k,v| v.nil? || v == ''}
129
- end
130
- end
131
- end
132
- end
@@ -1,55 +0,0 @@
1
- require 'omniauth/openid'
2
- module OmniAuth
3
- module Strategies
4
- class Steam < OmniAuth::Strategies::OpenID
5
- def initialize(app, store = nil, api_key = nil, options = {}, &block)
6
- options[:identifier] ||= "http://steamcommunity.com/openid"
7
- options[:name] ||= 'steam'
8
- @api_key = api_key
9
- super(app, store, options, &block)
10
- end
11
-
12
- def user_info(response=nil)
13
- player = user_hash['response']['players']['player'].first
14
- nickname = player["personaname"]
15
- name = player["realname"]
16
- url = player["profileurl"]
17
- country = player["loccountrycode"]
18
- state = player["locstatecode"]
19
- city = player["loccityid"]
20
-
21
- {
22
- 'nickname' => nickname,
23
- 'name' => name,
24
- 'url' => url,
25
- 'location' => "#{city}, #{state}, #{country}"
26
- }
27
- end
28
-
29
- def user_hash
30
- # Steam provides no information back on a openid response other than a 64bit user id
31
- # Need to use this information and make a API call to get user information from steam.
32
- if @api_key
33
- unless @user_hash
34
- uri = URI.parse("http://api.steampowered.com/")
35
- req = Net::HTTP::Get.new("#{uri.path}ISteamUser/GetPlayerSummaries/v0001/?key=#{@api_key}&steamids=#{@openid_response.display_identifier.split("/").last}")
36
- res = Net::HTTP.start(uri.host, uri.port) {|http|
37
- http.request(req)
38
- }
39
- end
40
- @user_hash ||= MultiJson.decode(res.body)
41
- else
42
- {}
43
- end
44
- end
45
-
46
- def auth_hash
47
- OmniAuth::Utils.deep_merge(super, {
48
- 'uid' => @openid_response.display_identifier.split("/").last,
49
- 'user_info' => user_info,
50
- 'extra' => {'user_hash' => user_hash}
51
- })
52
- end
53
- end
54
- end
55
- end
@@ -1,19 +0,0 @@
1
- module OmniAuth
2
- module Version
3
- unless defined?(::OmniAuth::Version::MAJOR)
4
- MAJOR = 0
5
- end
6
- unless defined?(::OmniAuth::Version::MINOR)
7
- MINOR = 2
8
- end
9
- unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 6
11
- end
12
- unless defined?(::OmniAuth::Version::PRE)
13
- PRE = nil
14
- end
15
- unless defined?(::OmniAuth::Version::STRING)
16
- STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
17
- end
18
- end
19
- end
@@ -1,28 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/omniauth/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
6
- gem.add_runtime_dependency 'rack-openid', '~> 1.3.1'
7
- gem.add_runtime_dependency 'ruby-openid-apps-discovery', '~> 1.2.0'
8
- gem.add_development_dependency 'maruku', '~> 0.6'
9
- gem.add_development_dependency 'rack-test', '~> 0.5'
10
- gem.add_development_dependency 'rake', '~> 0.8'
11
- gem.add_development_dependency 'rspec', '~> 2.5'
12
- gem.add_development_dependency 'simplecov', '~> 0.4'
13
- gem.add_development_dependency 'webmock', '~> 1.6'
14
- gem.add_development_dependency 'yard', '~> 0.7'
15
- gem.add_development_dependency 'ZenTest', '~> 4.5'
16
- gem.name = 'oa-openid'
17
- gem.version = OmniAuth::Version::STRING
18
- gem.description = %q{OpenID strategies for OmniAuth.}
19
- gem.summary = gem.description
20
- gem.email = ['michael@intridea.com', 'sferik@gmail.com']
21
- gem.homepage = 'http://github.com/intridea/omniauth'
22
- gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
23
- gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
24
- gem.files = `git ls-files`.split("\n")
25
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
- gem.require_paths = ['lib']
27
- gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
28
- end
@@ -1,71 +0,0 @@
1
- require File.expand_path('../../../spec_helper', __FILE__)
2
-
3
- describe OmniAuth::Strategies::OpenID do
4
-
5
- end
6
-
7
- # require File.dirname(__FILE__) + '/../../spec_helper'
8
- #
9
- # describe OmniAuth::Strategies::OpenID, :type => :strategy do
10
- #
11
- # include OmniAuth::Test::StrategyTestCase
12
- #
13
- # def strategy
14
- # [OmniAuth::Strategies::OpenID]
15
- # end
16
- #
17
- # describe '/auth/open_id without an identifier URL' do
18
- # before do
19
- # get '/auth/open_id'
20
- # end
21
- #
22
- # it 'should respond with OK' do
23
- # last_response.should be_ok
24
- # end
25
- #
26
- # it 'should respond with HTML' do
27
- # last_response.content_type.should == 'text/html'
28
- # end
29
- #
30
- # it 'should render an identifier URL input' do
31
- # last_response.body.should =~ %r{<input[^>]*#{OmniAuth::Strategies::OpenID::IDENTIFIER_URL_PARAMETER}}
32
- # end
33
- # end
34
- #
35
- # describe '/auth/open_id with an identifier URL' do
36
- # before do
37
- # @identifier_url = 'http://me.example.org'
38
- # # TODO: change this mock to actually return some sort of OpenID response
39
- # stub_request(:get, @identifier_url)
40
- # get '/auth/open_id?openid_url=' + @identifier_url
41
- # end
42
- #
43
- # it 'should redirect to the OpenID identity URL' do
44
- # last_response.should be_redirect
45
- # last_response.headers['Location'].should =~ %r{^#{@identifier_url}.*}
46
- # end
47
- #
48
- # it 'should tell the OpenID server to return to the callback URL' do
49
- # return_to = CGI.escape(last_request.url + '/callback')
50
- # last_response.headers['Location'].should =~ %r{[\?&]openid.return_to=#{return_to}}
51
- # end
52
- #
53
- # end
54
- #
55
- # describe 'followed by /auth/open_id/callback' do
56
- # before do
57
- # @identifier_url = 'http://me.example.org'
58
- # # TODO: change this mock to actually return some sort of OpenID response
59
- # stub_request(:get, @identifier_url)
60
- # get '/auth/open_id/callback'
61
- # end
62
- #
63
- # sets_an_auth_hash
64
- # sets_provider_to 'open_id'
65
- # sets_uid_to 'http://me.example.org'
66
- #
67
- # it 'should call through to the master app' do
68
- # last_response.body.should == 'true'
69
- # end
70
- # end
71
- # end
@@ -1,14 +0,0 @@
1
- require 'simplecov'
2
- SimpleCov.start
3
- require 'rspec'
4
- require 'rack/test'
5
- require 'webmock/rspec'
6
- require 'omniauth/core'
7
- require 'omniauth/test'
8
- require 'omniauth/openid'
9
-
10
- RSpec.configure do |config|
11
- config.include WebMock::API
12
- config.include Rack::Test::Methods
13
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
14
- end
data/omniauth.gemspec DELETED
@@ -1,20 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/omniauth/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- %w(oa-basic oa-enterprise oa-core oa-more oa-oauth oa-openid).each do |subgem|
6
- gem.add_runtime_dependency subgem, OmniAuth::Version::STRING
7
- end
8
- gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
9
- gem.description = %q{OmniAuth is an authentication framework that that separates the concept of authentiation from the concept of identity, providing simple hooks for any application to have one or multiple authentication providers for a user.}
10
- gem.email = ['michael@intridea.com', 'sferik@gmail.com']
11
- gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
12
- gem.files = `git ls-files`.split("\n")
13
- gem.homepage = 'http://github.com/intridea/omniauth'
14
- gem.name = 'omniauth'
15
- gem.require_paths = ['lib']
16
- gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
17
- gem.summary = %q{Rack middleware for standardized multi-provider authentication.}
18
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- gem.version = OmniAuth::Version::STRING
20
- end
data/tasks/all.rb DELETED
@@ -1,134 +0,0 @@
1
- require 'fileutils'
2
-
3
- PROJECTS = %w(oa-core oa-basic oa-enterprise oa-more oa-oauth oa-openid omniauth)
4
-
5
- def root
6
- File.expand_path('../../', __FILE__)
7
- end
8
-
9
- require root + '/lib/omniauth/version'
10
-
11
- def version
12
- ::OmniAuth::Version.constants.each do |const|
13
- ::OmniAuth::Version.send(:remove_const, const)
14
- end
15
- load root + '/lib/omniauth/version.rb'
16
- OmniAuth::Version::STRING
17
- end
18
-
19
- PROJECTS.each do |project|
20
- namespace project.to_sym do
21
- dir = root + (project == 'omniauth' ? '' : "/#{project}")
22
- package_dir = "#{dir}/pkg"
23
- coverage_dir = "#{dir}/coverage"
24
- temp_dir = "#{dir}/tmp"
25
- gem = "#{project}-#{version}.gem"
26
- gemspec = "#{project}.gemspec"
27
-
28
- task :clean do
29
- rm_rf package_dir
30
- rm_rf coverage_dir
31
- rm_rf temp_dir
32
- end
33
-
34
- task :build => :clean do
35
- cd dir
36
- sh "gem build #{gemspec}"
37
- mkdir_p package_dir unless Dir.exists?(package_dir)
38
- mv gem, "#{package_dir}/#{gem}"
39
- end
40
-
41
- task :install => :build do
42
- sh "gem install #{package_dir}/#{gem}"
43
- end
44
-
45
- task :push => :build do
46
- sh "gem push #{package_dir}/#{gem}"
47
- end
48
-
49
- task :version do
50
- puts "#{project}: #{version}"
51
- end
52
-
53
- namespace :version do
54
-
55
- destination = "#{dir}/lib/omniauth/version.rb"
56
-
57
- task :write do
58
- write_version(destination, ENV['MAJOR'], ENV['MINOR'], ENV['PATCH'], ENV['PRE'])
59
- end
60
-
61
- namespace :bump do
62
-
63
- task :major do
64
- bump_version(destination, 0)
65
- end
66
-
67
- task :minor do
68
- bump_version(destination, 1)
69
- end
70
-
71
- task :patch do
72
- bump_version(destination, 2)
73
- end
74
-
75
- end
76
-
77
- end
78
-
79
- task :spec do
80
- cd dir
81
- sh "#{$0} spec"
82
- end
83
-
84
- end
85
- end
86
-
87
- namespace :all do
88
- task :clean => PROJECTS.map{|project| "#{project}:clean"}
89
- task :build => PROJECTS.map{|project| "#{project}:build"}
90
- task :install => PROJECTS.map{|project| "#{project}:install"}
91
- task :push => PROJECTS.map{|project| "#{project}:push"}
92
- task "version" => PROJECTS.map{|project| "#{project}:version"}
93
- task "version:write" => PROJECTS.map{|project| "#{project}:version:write"} + [:version]
94
- task "version:bump:major" => PROJECTS.map{|project| "#{project}:version:bump:major"} + [:version]
95
- task "version:bump:minor" => PROJECTS.map{|project| "#{project}:version:bump:minor"} + [:version]
96
- task "version:bump:patch" => PROJECTS.map{|project| "#{project}:version:bump:patch"} + [:version]
97
- task :spec do
98
- errors = []
99
- PROJECTS.map do |project|
100
- next if project == "omniauth"
101
- Rake::Task["#{project}:spec"].invoke || errors << project
102
- end
103
- fail("Errors in #{errors.join(', ')}") unless errors.empty?
104
- end
105
- end
106
-
107
- def write_version(destination, major=nil, minor=nil, patch=nil, pre=nil)
108
- source = "#{root}/lib/omniauth/version.rb"
109
- v = version.split('.')
110
- v[0] = major if major
111
- v[1] = minor if minor
112
- v[2] = patch if patch
113
- v[3] = pre if pre
114
- v[3] = v[3] ? v[3].to_s : "nil"
115
-
116
- ruby = File.read(source)
117
- ruby.gsub! /^(\s*)MAJOR = .*?$/, "\\1MAJOR = #{v[0]}"
118
- fail "Could not insert MAJOR in #{source}" unless $1
119
- ruby.gsub! /^(\s*)MINOR = .*?$/, "\\1MINOR = #{v[1]}"
120
- fail "Could not insert MINOR in #{source}" unless $1
121
- ruby.gsub! /^(\s*)PATCH = .*?$/, "\\1PATCH = #{v[2]}"
122
- fail "Could not insert PATCH in #{source}" unless $1
123
- ruby.gsub! /^(\s*)PRE = .*?$/, "\\1PRE = #{v[3]}"
124
- fail "Could not insert PRE in #{source}" unless $1
125
- File.open(destination, 'w') do |file|
126
- file.write ruby
127
- end
128
- end
129
-
130
- def bump_version(destination, position)
131
- v = version.split('.').map{|s| s.to_i}
132
- v[position] += 1
133
- write_version(destination, *v)
134
- end