omniauth 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of omniauth might be problematic. Click here for more details.

Files changed (197) hide show
  1. data/.autotest +9 -0
  2. data/.document +5 -0
  3. data/.gitignore +36 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +7 -0
  6. data/.yardopts +4 -0
  7. data/Gemfile +6 -1
  8. data/README.markdown +121 -0
  9. data/Rakefile +50 -2
  10. data/lib/omniauth/version.rb +18 -4
  11. data/oa-basic/.gemtest +0 -0
  12. data/oa-basic/.rspec +3 -0
  13. data/oa-basic/.yardopts +4 -0
  14. data/oa-basic/LICENSE +19 -0
  15. data/oa-basic/README.rdoc +34 -0
  16. data/oa-basic/Rakefile +6 -0
  17. data/oa-basic/lib/oa-basic.rb +1 -0
  18. data/oa-basic/lib/omniauth/basic.rb +8 -0
  19. data/oa-basic/lib/omniauth/strategies/http_basic.rb +56 -0
  20. data/oa-basic/lib/omniauth/version.rb +19 -0
  21. data/oa-basic/oa-basic.gemspec +28 -0
  22. data/oa-basic/spec/omniauth/strategies/basic_spec.rb +7 -0
  23. data/oa-basic/spec/spec_helper.rb +11 -0
  24. data/oa-core/.gemtest +0 -0
  25. data/oa-core/.rspec +3 -0
  26. data/oa-core/.yardopts +4 -0
  27. data/oa-core/LICENSE +19 -0
  28. data/oa-core/Rakefile +6 -0
  29. data/oa-core/autotest/discover.rb +1 -0
  30. data/oa-core/lib/oa-core.rb +1 -0
  31. data/oa-core/lib/omniauth/builder.rb +33 -0
  32. data/oa-core/lib/omniauth/core.rb +135 -0
  33. data/oa-core/lib/omniauth/form.rb +184 -0
  34. data/oa-core/lib/omniauth/strategy.rb +227 -0
  35. data/oa-core/lib/omniauth/test.rb +12 -0
  36. data/oa-core/lib/omniauth/test/phony_session.rb +8 -0
  37. data/oa-core/lib/omniauth/test/strategy_macros.rb +34 -0
  38. data/oa-core/lib/omniauth/test/strategy_test_case.rb +49 -0
  39. data/oa-core/lib/omniauth/version.rb +19 -0
  40. data/oa-core/oa-core.gemspec +24 -0
  41. data/oa-core/spec/omniauth/builder_spec.rb +20 -0
  42. data/oa-core/spec/omniauth/core_spec.rb +79 -0
  43. data/oa-core/spec/omniauth/strategy_spec.rb +358 -0
  44. data/oa-core/spec/spec_helper.rb +12 -0
  45. data/oa-enterprise/.gemtest +0 -0
  46. data/oa-enterprise/.rspec +3 -0
  47. data/oa-enterprise/.yardopts +4 -0
  48. data/oa-enterprise/LICENSE +19 -0
  49. data/oa-enterprise/README.rdoc +82 -0
  50. data/oa-enterprise/Rakefile +6 -0
  51. data/oa-enterprise/lib/oa-enterprise.rb +1 -0
  52. data/oa-enterprise/lib/omniauth/enterprise.rb +8 -0
  53. data/oa-enterprise/lib/omniauth/strategies/cas.rb +47 -0
  54. data/oa-enterprise/lib/omniauth/strategies/cas/configuration.rb +98 -0
  55. data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +84 -0
  56. data/oa-enterprise/lib/omniauth/strategies/ldap.rb +111 -0
  57. data/oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb +279 -0
  58. data/oa-enterprise/lib/omniauth/version.rb +19 -0
  59. data/oa-enterprise/oa-enterprise.gemspec +32 -0
  60. data/oa-enterprise/spec/fixtures/cas_failure.xml +4 -0
  61. data/oa-enterprise/spec/fixtures/cas_success.xml +8 -0
  62. data/oa-enterprise/spec/omniauth/strategies/cas_spec.rb +94 -0
  63. data/oa-enterprise/spec/spec_helper.rb +14 -0
  64. data/oa-more/.gemtest +0 -0
  65. data/oa-more/.rspec +3 -0
  66. data/oa-more/.yardopts +4 -0
  67. data/oa-more/LICENSE +19 -0
  68. data/oa-more/README.rdoc +22 -0
  69. data/oa-more/Rakefile +6 -0
  70. data/oa-more/lib/oa-more.rb +1 -0
  71. data/oa-more/lib/omniauth/more.rb +9 -0
  72. data/oa-more/lib/omniauth/strategies/flickr.rb +86 -0
  73. data/oa-more/lib/omniauth/strategies/windows_live.rb +39 -0
  74. data/oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb +1143 -0
  75. data/oa-more/lib/omniauth/strategies/yupoo.rb +67 -0
  76. data/oa-more/lib/omniauth/version.rb +19 -0
  77. data/oa-more/oa-more.gemspec +30 -0
  78. data/oa-more/spec/omniauth/strategies/flickr_spec.rb +7 -0
  79. data/oa-more/spec/spec_helper.rb +11 -0
  80. data/oa-oauth/.gemtest +0 -0
  81. data/oa-oauth/.rspec +3 -0
  82. data/oa-oauth/.yardopts +4 -0
  83. data/oa-oauth/LICENSE +19 -0
  84. data/oa-oauth/README.rdoc +35 -0
  85. data/oa-oauth/Rakefile +6 -0
  86. data/oa-oauth/autotest/discover.rb +1 -0
  87. data/oa-oauth/lib/oa-oauth.rb +1 -0
  88. data/oa-oauth/lib/omniauth/oauth.rb +53 -0
  89. data/oa-oauth/lib/omniauth/strategies/bitly.rb +46 -0
  90. data/oa-oauth/lib/omniauth/strategies/dailymile.rb +64 -0
  91. data/oa-oauth/lib/omniauth/strategies/doit.rb +60 -0
  92. data/oa-oauth/lib/omniauth/strategies/dopplr.rb +53 -0
  93. data/oa-oauth/lib/omniauth/strategies/douban.rb +60 -0
  94. data/oa-oauth/lib/omniauth/strategies/evernote.rb +54 -0
  95. data/oa-oauth/lib/omniauth/strategies/facebook.rb +70 -0
  96. data/oa-oauth/lib/omniauth/strategies/foursquare.rb +62 -0
  97. data/oa-oauth/lib/omniauth/strategies/github.rb +50 -0
  98. data/oa-oauth/lib/omniauth/strategies/goodreads.rb +44 -0
  99. data/oa-oauth/lib/omniauth/strategies/google.rb +80 -0
  100. data/oa-oauth/lib/omniauth/strategies/gowalla.rb +64 -0
  101. data/oa-oauth/lib/omniauth/strategies/hyves.rb +67 -0
  102. data/oa-oauth/lib/omniauth/strategies/identica.rb +49 -0
  103. data/oa-oauth/lib/omniauth/strategies/instagram.rb +56 -0
  104. data/oa-oauth/lib/omniauth/strategies/instapaper.rb +40 -0
  105. data/oa-oauth/lib/omniauth/strategies/linked_in.rb +55 -0
  106. data/oa-oauth/lib/omniauth/strategies/meetup.rb +56 -0
  107. data/oa-oauth/lib/omniauth/strategies/miso.rb +41 -0
  108. data/oa-oauth/lib/omniauth/strategies/mixi.rb +59 -0
  109. data/oa-oauth/lib/omniauth/strategies/netflix.rb +65 -0
  110. data/oa-oauth/lib/omniauth/strategies/oauth.rb +85 -0
  111. data/oa-oauth/lib/omniauth/strategies/oauth2.rb +98 -0
  112. data/oa-oauth/lib/omniauth/strategies/qzone.rb +69 -0
  113. data/oa-oauth/lib/omniauth/strategies/rdio.rb +45 -0
  114. data/oa-oauth/lib/omniauth/strategies/renren.rb +87 -0
  115. data/oa-oauth/lib/omniauth/strategies/salesforce.rb +44 -0
  116. data/oa-oauth/lib/omniauth/strategies/smug_mug.rb +42 -0
  117. data/oa-oauth/lib/omniauth/strategies/sound_cloud.rb +46 -0
  118. data/oa-oauth/lib/omniauth/strategies/t163.rb +57 -0
  119. data/oa-oauth/lib/omniauth/strategies/teambox.rb +49 -0
  120. data/oa-oauth/lib/omniauth/strategies/thirty_seven_signals.rb +41 -0
  121. data/oa-oauth/lib/omniauth/strategies/tqq.rb +64 -0
  122. data/oa-oauth/lib/omniauth/strategies/trade_me.rb +45 -0
  123. data/oa-oauth/lib/omniauth/strategies/trip_it.rb +22 -0
  124. data/oa-oauth/lib/omniauth/strategies/tsina.rb +79 -0
  125. data/oa-oauth/lib/omniauth/strategies/tsohu.rb +57 -0
  126. data/oa-oauth/lib/omniauth/strategies/tumblr.rb +60 -0
  127. data/oa-oauth/lib/omniauth/strategies/twitter.rb +57 -0
  128. data/oa-oauth/lib/omniauth/strategies/type_pad.rb +76 -0
  129. data/oa-oauth/lib/omniauth/strategies/vimeo.rb +54 -0
  130. data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +84 -0
  131. data/oa-oauth/lib/omniauth/strategies/xauth.rb +67 -0
  132. data/oa-oauth/lib/omniauth/strategies/yahoo.rb +55 -0
  133. data/oa-oauth/lib/omniauth/strategies/yammer.rb +43 -0
  134. data/oa-oauth/lib/omniauth/strategies/you_tube.rb +73 -0
  135. data/oa-oauth/lib/omniauth/version.rb +19 -0
  136. data/oa-oauth/oa-oauth.gemspec +33 -0
  137. data/oa-oauth/spec/fixtures/basecamp_200.xml +24 -0
  138. data/oa-oauth/spec/fixtures/campfire_200.json +10 -0
  139. data/oa-oauth/spec/omniauth/strategies/bitly_spec.rb +5 -0
  140. data/oa-oauth/spec/omniauth/strategies/dailymile_spec.rb +5 -0
  141. data/oa-oauth/spec/omniauth/strategies/doit_spec.rb +5 -0
  142. data/oa-oauth/spec/omniauth/strategies/dopplr_spec.rb +5 -0
  143. data/oa-oauth/spec/omniauth/strategies/douban_spec.rb +5 -0
  144. data/oa-oauth/spec/omniauth/strategies/evernote_spec.rb +5 -0
  145. data/oa-oauth/spec/omniauth/strategies/facebook_spec.rb +5 -0
  146. data/oa-oauth/spec/omniauth/strategies/foursquare_spec.rb +18 -0
  147. data/oa-oauth/spec/omniauth/strategies/github_spec.rb +5 -0
  148. data/oa-oauth/spec/omniauth/strategies/goodreads_spec.rb +6 -0
  149. data/oa-oauth/spec/omniauth/strategies/google_spec.rb +5 -0
  150. data/oa-oauth/spec/omniauth/strategies/gowalla_spec.rb +5 -0
  151. data/oa-oauth/spec/omniauth/strategies/hyves_spec.rb +5 -0
  152. data/oa-oauth/spec/omniauth/strategies/identica_spec.rb +5 -0
  153. data/oa-oauth/spec/omniauth/strategies/linked_in_spec.rb +5 -0
  154. data/oa-oauth/spec/omniauth/strategies/meetup_spec.rb +14 -0
  155. data/oa-oauth/spec/omniauth/strategies/miso_spec.rb +5 -0
  156. data/oa-oauth/spec/omniauth/strategies/netflix_spec.rb +5 -0
  157. data/oa-oauth/spec/omniauth/strategies/oauth2_spec.rb +0 -0
  158. data/oa-oauth/spec/omniauth/strategies/oauth_spec.rb +77 -0
  159. data/oa-oauth/spec/omniauth/strategies/rdio_spec.rb +5 -0
  160. data/oa-oauth/spec/omniauth/strategies/salesforce_spec.rb +5 -0
  161. data/oa-oauth/spec/omniauth/strategies/smug_mug_spec.rb +5 -0
  162. data/oa-oauth/spec/omniauth/strategies/sound_cloud_spec.rb +5 -0
  163. data/oa-oauth/spec/omniauth/strategies/t163_spec.rb +5 -0
  164. data/oa-oauth/spec/omniauth/strategies/teambox_spec.rb +5 -0
  165. data/oa-oauth/spec/omniauth/strategies/thirty_seven_signals_spec.rb +5 -0
  166. data/oa-oauth/spec/omniauth/strategies/trade_me_spec.rb +5 -0
  167. data/oa-oauth/spec/omniauth/strategies/trip_it_spec.rb +5 -0
  168. data/oa-oauth/spec/omniauth/strategies/tsina_spec.rb +5 -0
  169. data/oa-oauth/spec/omniauth/strategies/tumblr_spec.rb +5 -0
  170. data/oa-oauth/spec/omniauth/strategies/twitter_spec.rb +20 -0
  171. data/oa-oauth/spec/omniauth/strategies/type_pad_spec.rb +5 -0
  172. data/oa-oauth/spec/omniauth/strategies/vimeo_spec.rb +5 -0
  173. data/oa-oauth/spec/omniauth/strategies/vkontakte_spec.rb +5 -0
  174. data/oa-oauth/spec/omniauth/strategies/yahoo_spec.rb +5 -0
  175. data/oa-oauth/spec/omniauth/strategies/yammer_spec.rb +5 -0
  176. data/oa-oauth/spec/omniauth/strategies/you_tube_spec.rb +5 -0
  177. data/oa-oauth/spec/spec_helper.rb +27 -0
  178. data/oa-oauth/spec/support/shared_examples.rb +29 -0
  179. data/oa-openid/.gemtest +0 -0
  180. data/oa-openid/.rspec +3 -0
  181. data/oa-openid/.yardopts +4 -0
  182. data/oa-openid/LICENSE +19 -0
  183. data/oa-openid/README.rdoc +51 -0
  184. data/oa-openid/Rakefile +6 -0
  185. data/oa-openid/lib/oa-openid.rb +1 -0
  186. data/oa-openid/lib/omniauth/openid.rb +59 -0
  187. data/oa-openid/lib/omniauth/openid/gapps.rb +32 -0
  188. data/oa-openid/lib/omniauth/strategies/google_apps.rb +23 -0
  189. data/oa-openid/lib/omniauth/strategies/open_id.rb +132 -0
  190. data/oa-openid/lib/omniauth/version.rb +19 -0
  191. data/oa-openid/oa-openid.gemspec +29 -0
  192. data/oa-openid/spec/omniauth/strategies/open_id_spec.rb +71 -0
  193. data/oa-openid/spec/spec_helper.rb +14 -0
  194. data/omniauth.gemspec +3 -3
  195. data/tasks/all.rb +134 -0
  196. metadata +199 -9
  197. data/README.rdoc +0 -17
data/.autotest ADDED
@@ -0,0 +1,9 @@
1
+ require 'autotest/bundler'
2
+
3
+ Autotest.add_hook :initialize do |at|
4
+ at.clear_mappings
5
+
6
+ at.add_mapping(%r{^.*/spec/.*_spec.rb$}) do |filename, _|
7
+ filename
8
+ end
9
+ end
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ /live
5
+ .rvmrc
6
+
7
+ dist/*
8
+
9
+ ## TEXTMATE
10
+ *.tmproj
11
+ tmtags
12
+
13
+ ## EMACS
14
+ *~
15
+ \#*
16
+ .\#*
17
+
18
+ ## VIM
19
+ *.swp
20
+
21
+ ## PROJECT::GENERAL
22
+ coverage
23
+ rdoc
24
+ pkg
25
+ tmp
26
+ oa-live
27
+
28
+ ## PROJECT::SPECIFIC
29
+ *.gem
30
+ .bundle
31
+ .project
32
+ .loadpath
33
+ .yardoc
34
+ doc
35
+
36
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=progress
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ script: "bundle exec rake test"
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.1
5
+ - 1.9.2
6
+ - rbx
7
+ - ree
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --markup markdown
2
+ --markup-provider maruku
3
+ -
4
+ LICENSE
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gemspec
3
+ gemspec :path => 'oa-basic'
4
+ gemspec :path => 'oa-core'
5
+ gemspec :path => 'oa-enterprise'
6
+ gemspec :path => 'oa-more'
7
+ gemspec :path => 'oa-oauth'
8
+ gemspec :path => 'oa-openid'
data/README.markdown ADDED
@@ -0,0 +1,121 @@
1
+ # OmniAuth: Standardized Multi-Provider Authentication
2
+
3
+ OmniAuth is a new Rack-based authentication system for multi-provider external authentcation. OmniAuth is built from the ground up on the philosophy that **authentication is not the same as identity**, and is based on two observations:
4
+
5
+ 1. The traditional 'sign up using a login and password' model is becoming the exception, not the rule. Modern web applications offer external authentication via OpenID, Facebook, and/or OAuth.
6
+ 2. The interconnectable web is no longer a dream, it is a necessity. It is not unreasonable to expect that one application may need to be able to connect to one, three, or twelve other services. Modern authentication systems should allow a user's identity to be associated with many authentications.
7
+
8
+ ## Installation
9
+
10
+ To install OmniAuth, simply install the gem:
11
+
12
+ gem install omniauth
13
+
14
+ ## Providers
15
+
16
+ OmniAuth currently supports the following external providers:
17
+
18
+ * via OAuth (OAuth 1.0, OAuth 2, and xAuth)
19
+ * 37signals ID (credit: [mbleigh](https://github.com/mbleigh))
20
+ * Bit.ly (credit: [philnash](https://github.com/philnash))
21
+ * DailyMile (credit: [cdmwebs](https://github.com/cdmwebs))
22
+ * Doit.im (credit: [chouti](https://github.com/chouti))
23
+ * Dopplr (credit: [flextrip](https://github.com/flextrip))
24
+ * Douban (credit: [quake](https://github.com/quake))
25
+ * Evernote (credit: [szimek](https://github.com/szimek))
26
+ * Facebook (credit: [mbleigh](https://github.com/mbleigh))
27
+ * Foursquare (credit: [mbleigh](https://github.com/mbleigh))
28
+ * GitHub (credit: [mbleigh](https://github.com/mbleigh))
29
+ * GoodReads (credit: [cristoffer](https://github.com/christoffer))
30
+ * Gowalla (credit: [kvnsmth](https://github.com/kvnsmth))
31
+ * Hyves (credit: [mrdg](https://github.com/mrdg))
32
+ * Identi.ca (credit: [dcu](https://github.com/dcu))
33
+ * Instagram (credit: [kiyoshi](https://github.com/kiyoshi))
34
+ * Instapaper (credit: [micpringle](https://github.com/micpringle))
35
+ * LinkedIn (credit: [mbleigh](https://github.com/mbleigh))
36
+ * Meetup (credit [coderoshi](https://github.com/coderoshi))
37
+ * Miso (credit: [rickenharp](https://github.com/rickenharp))
38
+ * Mixi (credit: [kiyoshi](https://github.com/kiyoshi))
39
+ * Netflix (credit: [caged](https://github.com/caged))
40
+ * Qzone (credit: [quake](https://github.com/quake))
41
+ * Rdio (via [brandonweiss](http://github.com/brandonweiss))
42
+ * Renren (credit: [quake](https://github.com/quake))
43
+ * Salesforce (via [CloudSpokes](http://www.cloudspokes.com))
44
+ * SmugMug (credit: [pchilton](https://github.com/pchilton))
45
+ * SoundCloud (credit: [leemartin](https://github.com/leemartin))
46
+ * T163 (credit: [quake](https://github.com/quake))
47
+ * TeamBox (credit [jrom](https://github.com/jrom))
48
+ * Tqq (credit: [quake](https://github.com/quake))
49
+ * TradeMe (credit: [pchilton](https://github.com/pchilton))
50
+ * TripIt (credit: [flextrip](https://github.com/flextrip))
51
+ * Tsina (credit: [quake](https://github.com/quake))
52
+ * Tsohu (credit: [quake](https://github.com/quake))
53
+ * Tumblr (credit: [jamiew](https://github.com/jamiew))
54
+ * Twitter (credit: [mbleigh](https://github.com/mbleigh))
55
+ * Vimeo (credit: [jamiew](https://github.com/jamiew))
56
+ * Vkontakte (credit: [german](https://github.com/german))
57
+ * Yammer (credit: [kltcalamay](https://github.com/kltcalamay))
58
+ * YouTube (credit: [jamiew](https://github.com/jamiew))
59
+ * CAS (Central Authentication Service) (credit: [jamesarosen](https://github.com/jamesarosen))
60
+ * Flickr (credit: [pchilton](https://github.com/pchilton))
61
+ * Google Apps (via OpenID) (credit: [mbleigh](https://github.com/mbleigh))
62
+ * LDAP (credit: [pyu10055](https://github.com/pyu10055))
63
+ * OpenID (credit: [mbleigh](https://github.com/mbleigh))
64
+ * Yupoo (credit: [chouti](https://github.com/chouti))
65
+
66
+ ## Compatibility
67
+
68
+ OmniAuth is tested against the following Ruby versions:
69
+
70
+ * 1.8.7
71
+ * 1.9.1
72
+ * 1.9.2
73
+ * jRuby (note, the Evernote strategy is not available for jRuby)
74
+ * Rubinius
75
+ * REE
76
+
77
+ ## Usage
78
+
79
+ OmniAuth is a collection of Rack middleware. To use a single strategy, you simply need to add the middleware:
80
+
81
+ require 'oa-oauth'
82
+ use OmniAuth::Strategies::Twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET'
83
+
84
+ Now to initiate authentication you merely need to redirect the user to `/auth/twitter` via a link or other means. Once the user has authenticated to Twitter, they will be redirected to `/auth/twitter/callback`. You should build an endpoint that handles this URL, at which point you will will have access to the authentication information through the `omniauth.auth` parameter of the Rack environment. For example, in Sinatra you would do something like this:
85
+
86
+ get '/auth/twitter/callback' do
87
+ auth_hash = request.env['omniauth.auth']
88
+ end
89
+
90
+ The hash in question will look something like this:
91
+
92
+ {
93
+ 'uid' => '12356',
94
+ 'provider' => 'twitter',
95
+ 'user_info' => {
96
+ 'name' => 'User Name',
97
+ 'nickname' => 'username',
98
+ # ...
99
+ }
100
+ }
101
+
102
+ The `user_info` hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.
103
+
104
+ ## Resources
105
+
106
+ The best place to find more information is the [OmniAuth Wiki](http://github.com/intridea/omniauth/wiki). Some specific information you might be interested in:
107
+
108
+ * [CI Build Status](http://travis-ci.org/#!/intridea/omniauth)
109
+ * [Roadmap](http://github.com/intridea/omniauth/wiki/Roadmap)
110
+ * [Changelog](http://github.com/intridea/omniauth/wiki/Changelog)
111
+ * [Report Issues](http://github.com/intridea/omniauth/issues)
112
+ * [Mailing List](http://groups.google.com/group/omniauth)
113
+
114
+ ## OmniAuth Core
115
+
116
+ * **Michael Bleigh** ([mbleigh](https://github.com/mbleigh))
117
+ * **Erik Michaels-Ober** ([sferik](https://github.com/sferik))
118
+
119
+ ## License
120
+
121
+ OmniAuth is licensed under the MIT License.
data/Rakefile CHANGED
@@ -1,2 +1,50 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ require 'tasks/all'
3
+
4
+ desc 'Clean up temporary files'
5
+ task :clean => 'all:clean'
6
+
7
+ desc 'Build gem files for all projects into the package directory'
8
+ task :build => 'all:build'
9
+
10
+ desc 'Build and install gems for all projects'
11
+ task :install => 'all:install'
12
+
13
+ desc 'Write version with MAJOR, MINOR, PATCH, and PRE environment variables'
14
+ task 'version:write' => 'all:version:write'
15
+
16
+ desc 'Display the current version for all projects'
17
+ task :version => 'all:version'
18
+ desc 'Increment the major version for all projects'
19
+ task 'version:bump:major' => 'all:version:bump:major'
20
+ desc 'Increment the minor version for all projects'
21
+ task 'version:bump:minor' => 'all:version:bump:minor'
22
+ desc 'Increment the patch version for all projects'
23
+ task 'version:bump:patch' => 'all:version:bump:patch'
24
+
25
+ desc 'Run specs for all projects'
26
+ task :spec => 'all:spec'
27
+ task :test => :spec
28
+ task :default => :test
29
+
30
+ desc 'Generate docs for all projects'
31
+ task 'doc:yard' => 'all:doc:yard'
32
+
33
+ task :tag do
34
+ sh "git tag -a -m \"Version #{version}\" v#{version}"
35
+ sh "git push"
36
+ sh "git push --tags"
37
+ end
38
+
39
+ task :push => 'all:push'
40
+
41
+ desc 'Build, tag, and push gems for all projects to Rubygems'
42
+ task :release => [:build, :tag, :push]
43
+
44
+ namespace :doc do
45
+ require 'yard'
46
+ YARD::Rake::YardocTask.new do |task|
47
+ task.files = PROJECTS.map{|project| "#{root}/#{project}/lib/**/*.rb"} + ['README.markdown', 'LICENSE']
48
+ end
49
+ end
50
+
@@ -1,5 +1,19 @@
1
- module Omniauth
2
- # The version of the gem
3
- VERSION = '0.2.4'.freeze unless defined?(::Omniauth::VERSION)
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 = 5
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
4
19
  end
5
-
data/oa-basic/.gemtest ADDED
File without changes
data/oa-basic/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=nested
3
+ --backtrace
@@ -0,0 +1,4 @@
1
+ --markup markdown
2
+ --markup-provider maruku
3
+ -
4
+ LICENSE
data/oa-basic/LICENSE ADDED
@@ -0,0 +1,19 @@
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.
@@ -0,0 +1,34 @@
1
+ = OmniAuth::Basic
2
+
3
+ OmniAuth stratgies for APIs that have HTTP Basic authentication (such as Campfire and Basecamp).
4
+
5
+ == Installation
6
+
7
+ To get just HTTP Basic functionality:
8
+
9
+ gem install oa-basic
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/basic'
20
+
21
+ use OmniAuth::Strategies::Campfire
22
+
23
+ Then simply direct users to '/auth/campfire' to prompt them for their Campfire credentials. You may also pre-set the credentials by POSTing to the URL with appropriate parameters (in the case of Campfire and Basecamp, the parameters are <tt>subdomain</tt>, <tt>user</tt>, and <tt>password</tt>).
24
+
25
+ == OmniAuth Builder
26
+
27
+ If you want to allow multiple providers, use the OmniAuth Builder:
28
+
29
+ require 'omniauth/basic'
30
+
31
+ use OmniAuth::Builder do
32
+ provider :campfire
33
+ provider :basecamp
34
+ end
data/oa-basic/Rakefile ADDED
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
1
+ require 'omniauth/basic'
@@ -0,0 +1,8 @@
1
+ require 'omniauth/core'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ autoload :HttpBasic, 'omniauth/strategies/http_basic'
6
+ # autoload :Gowalla, 'omniauth/strategies/gowalla'
7
+ end
8
+ end
@@ -0,0 +1,56 @@
1
+ require 'rest-client'
2
+ require 'omniauth/basic'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class HttpBasic
7
+ include OmniAuth::Strategy
8
+
9
+ def initialize(app, name, endpoint = nil, headers = {}, &block)
10
+ super
11
+ @endpoint = endpoint
12
+ @request_headers = headers
13
+ end
14
+
15
+ attr_reader :endpoint, :request_headers
16
+
17
+ def request_phase
18
+ if env['REQUEST_METHOD'] == 'GET'
19
+ get_credentials
20
+ else
21
+ perform
22
+ end
23
+ end
24
+
25
+ def title
26
+ name.split('_').map{|s| s.capitalize}.join(' ')
27
+ end
28
+
29
+ def get_credentials
30
+ OmniAuth::Form.build(:title => title) do
31
+ text_field 'Username', 'username'
32
+ password_field 'Password', 'password'
33
+ end.to_response
34
+ end
35
+
36
+ def perform
37
+ @response = perform_authentication(endpoint)
38
+ @env['omniauth.auth'] = auth_hash
39
+ @env['REQUEST_METHOD'] = 'GET'
40
+ @env['PATH_INFO'] = "#{OmniAuth.config.path_prefix}/#{name}/callback"
41
+
42
+ call_app!
43
+ rescue RestClient::Request::Unauthorized => e
44
+ fail!(:invalid_credentials, e)
45
+ end
46
+
47
+ def perform_authentication(uri, headers = request_headers)
48
+ RestClient.get(uri, headers)
49
+ end
50
+
51
+ def callback_phase
52
+ fail!(:invalid_credentials)
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,19 @@
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 = 5
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