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.
- data/.autotest +9 -0
- data/.document +5 -0
- data/.gitignore +36 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/.yardopts +4 -0
- data/Gemfile +6 -1
- data/README.markdown +121 -0
- data/Rakefile +50 -2
- data/lib/omniauth/version.rb +18 -4
- data/oa-basic/.gemtest +0 -0
- data/oa-basic/.rspec +3 -0
- data/oa-basic/.yardopts +4 -0
- data/oa-basic/LICENSE +19 -0
- data/oa-basic/README.rdoc +34 -0
- data/oa-basic/Rakefile +6 -0
- data/oa-basic/lib/oa-basic.rb +1 -0
- data/oa-basic/lib/omniauth/basic.rb +8 -0
- data/oa-basic/lib/omniauth/strategies/http_basic.rb +56 -0
- data/oa-basic/lib/omniauth/version.rb +19 -0
- data/oa-basic/oa-basic.gemspec +28 -0
- data/oa-basic/spec/omniauth/strategies/basic_spec.rb +7 -0
- data/oa-basic/spec/spec_helper.rb +11 -0
- data/oa-core/.gemtest +0 -0
- data/oa-core/.rspec +3 -0
- data/oa-core/.yardopts +4 -0
- data/oa-core/LICENSE +19 -0
- data/oa-core/Rakefile +6 -0
- data/oa-core/autotest/discover.rb +1 -0
- data/oa-core/lib/oa-core.rb +1 -0
- data/oa-core/lib/omniauth/builder.rb +33 -0
- data/oa-core/lib/omniauth/core.rb +135 -0
- data/oa-core/lib/omniauth/form.rb +184 -0
- data/oa-core/lib/omniauth/strategy.rb +227 -0
- data/oa-core/lib/omniauth/test.rb +12 -0
- data/oa-core/lib/omniauth/test/phony_session.rb +8 -0
- data/oa-core/lib/omniauth/test/strategy_macros.rb +34 -0
- data/oa-core/lib/omniauth/test/strategy_test_case.rb +49 -0
- data/oa-core/lib/omniauth/version.rb +19 -0
- data/oa-core/oa-core.gemspec +24 -0
- data/oa-core/spec/omniauth/builder_spec.rb +20 -0
- data/oa-core/spec/omniauth/core_spec.rb +79 -0
- data/oa-core/spec/omniauth/strategy_spec.rb +358 -0
- data/oa-core/spec/spec_helper.rb +12 -0
- data/oa-enterprise/.gemtest +0 -0
- data/oa-enterprise/.rspec +3 -0
- data/oa-enterprise/.yardopts +4 -0
- data/oa-enterprise/LICENSE +19 -0
- data/oa-enterprise/README.rdoc +82 -0
- data/oa-enterprise/Rakefile +6 -0
- data/oa-enterprise/lib/oa-enterprise.rb +1 -0
- data/oa-enterprise/lib/omniauth/enterprise.rb +8 -0
- data/oa-enterprise/lib/omniauth/strategies/cas.rb +47 -0
- data/oa-enterprise/lib/omniauth/strategies/cas/configuration.rb +98 -0
- data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +84 -0
- data/oa-enterprise/lib/omniauth/strategies/ldap.rb +111 -0
- data/oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb +279 -0
- data/oa-enterprise/lib/omniauth/version.rb +19 -0
- data/oa-enterprise/oa-enterprise.gemspec +32 -0
- data/oa-enterprise/spec/fixtures/cas_failure.xml +4 -0
- data/oa-enterprise/spec/fixtures/cas_success.xml +8 -0
- data/oa-enterprise/spec/omniauth/strategies/cas_spec.rb +94 -0
- data/oa-enterprise/spec/spec_helper.rb +14 -0
- data/oa-more/.gemtest +0 -0
- data/oa-more/.rspec +3 -0
- data/oa-more/.yardopts +4 -0
- data/oa-more/LICENSE +19 -0
- data/oa-more/README.rdoc +22 -0
- data/oa-more/Rakefile +6 -0
- data/oa-more/lib/oa-more.rb +1 -0
- data/oa-more/lib/omniauth/more.rb +9 -0
- data/oa-more/lib/omniauth/strategies/flickr.rb +86 -0
- data/oa-more/lib/omniauth/strategies/windows_live.rb +39 -0
- data/oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb +1143 -0
- data/oa-more/lib/omniauth/strategies/yupoo.rb +67 -0
- data/oa-more/lib/omniauth/version.rb +19 -0
- data/oa-more/oa-more.gemspec +30 -0
- data/oa-more/spec/omniauth/strategies/flickr_spec.rb +7 -0
- data/oa-more/spec/spec_helper.rb +11 -0
- data/oa-oauth/.gemtest +0 -0
- data/oa-oauth/.rspec +3 -0
- data/oa-oauth/.yardopts +4 -0
- data/oa-oauth/LICENSE +19 -0
- data/oa-oauth/README.rdoc +35 -0
- data/oa-oauth/Rakefile +6 -0
- data/oa-oauth/autotest/discover.rb +1 -0
- data/oa-oauth/lib/oa-oauth.rb +1 -0
- data/oa-oauth/lib/omniauth/oauth.rb +53 -0
- data/oa-oauth/lib/omniauth/strategies/bitly.rb +46 -0
- data/oa-oauth/lib/omniauth/strategies/dailymile.rb +64 -0
- data/oa-oauth/lib/omniauth/strategies/doit.rb +60 -0
- data/oa-oauth/lib/omniauth/strategies/dopplr.rb +53 -0
- data/oa-oauth/lib/omniauth/strategies/douban.rb +60 -0
- data/oa-oauth/lib/omniauth/strategies/evernote.rb +54 -0
- data/oa-oauth/lib/omniauth/strategies/facebook.rb +70 -0
- data/oa-oauth/lib/omniauth/strategies/foursquare.rb +62 -0
- data/oa-oauth/lib/omniauth/strategies/github.rb +50 -0
- data/oa-oauth/lib/omniauth/strategies/goodreads.rb +44 -0
- data/oa-oauth/lib/omniauth/strategies/google.rb +80 -0
- data/oa-oauth/lib/omniauth/strategies/gowalla.rb +64 -0
- data/oa-oauth/lib/omniauth/strategies/hyves.rb +67 -0
- data/oa-oauth/lib/omniauth/strategies/identica.rb +49 -0
- data/oa-oauth/lib/omniauth/strategies/instagram.rb +56 -0
- data/oa-oauth/lib/omniauth/strategies/instapaper.rb +40 -0
- data/oa-oauth/lib/omniauth/strategies/linked_in.rb +55 -0
- data/oa-oauth/lib/omniauth/strategies/meetup.rb +56 -0
- data/oa-oauth/lib/omniauth/strategies/miso.rb +41 -0
- data/oa-oauth/lib/omniauth/strategies/mixi.rb +59 -0
- data/oa-oauth/lib/omniauth/strategies/netflix.rb +65 -0
- data/oa-oauth/lib/omniauth/strategies/oauth.rb +85 -0
- data/oa-oauth/lib/omniauth/strategies/oauth2.rb +98 -0
- data/oa-oauth/lib/omniauth/strategies/qzone.rb +69 -0
- data/oa-oauth/lib/omniauth/strategies/rdio.rb +45 -0
- data/oa-oauth/lib/omniauth/strategies/renren.rb +87 -0
- data/oa-oauth/lib/omniauth/strategies/salesforce.rb +44 -0
- data/oa-oauth/lib/omniauth/strategies/smug_mug.rb +42 -0
- data/oa-oauth/lib/omniauth/strategies/sound_cloud.rb +46 -0
- data/oa-oauth/lib/omniauth/strategies/t163.rb +57 -0
- data/oa-oauth/lib/omniauth/strategies/teambox.rb +49 -0
- data/oa-oauth/lib/omniauth/strategies/thirty_seven_signals.rb +41 -0
- data/oa-oauth/lib/omniauth/strategies/tqq.rb +64 -0
- data/oa-oauth/lib/omniauth/strategies/trade_me.rb +45 -0
- data/oa-oauth/lib/omniauth/strategies/trip_it.rb +22 -0
- data/oa-oauth/lib/omniauth/strategies/tsina.rb +79 -0
- data/oa-oauth/lib/omniauth/strategies/tsohu.rb +57 -0
- data/oa-oauth/lib/omniauth/strategies/tumblr.rb +60 -0
- data/oa-oauth/lib/omniauth/strategies/twitter.rb +57 -0
- data/oa-oauth/lib/omniauth/strategies/type_pad.rb +76 -0
- data/oa-oauth/lib/omniauth/strategies/vimeo.rb +54 -0
- data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +84 -0
- data/oa-oauth/lib/omniauth/strategies/xauth.rb +67 -0
- data/oa-oauth/lib/omniauth/strategies/yahoo.rb +55 -0
- data/oa-oauth/lib/omniauth/strategies/yammer.rb +43 -0
- data/oa-oauth/lib/omniauth/strategies/you_tube.rb +73 -0
- data/oa-oauth/lib/omniauth/version.rb +19 -0
- data/oa-oauth/oa-oauth.gemspec +33 -0
- data/oa-oauth/spec/fixtures/basecamp_200.xml +24 -0
- data/oa-oauth/spec/fixtures/campfire_200.json +10 -0
- data/oa-oauth/spec/omniauth/strategies/bitly_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/dailymile_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/doit_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/dopplr_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/douban_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/evernote_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/facebook_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/foursquare_spec.rb +18 -0
- data/oa-oauth/spec/omniauth/strategies/github_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/goodreads_spec.rb +6 -0
- data/oa-oauth/spec/omniauth/strategies/google_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/gowalla_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/hyves_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/identica_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/linked_in_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/meetup_spec.rb +14 -0
- data/oa-oauth/spec/omniauth/strategies/miso_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/netflix_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/oauth2_spec.rb +0 -0
- data/oa-oauth/spec/omniauth/strategies/oauth_spec.rb +77 -0
- data/oa-oauth/spec/omniauth/strategies/rdio_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/salesforce_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/smug_mug_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/sound_cloud_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/t163_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/teambox_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/thirty_seven_signals_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/trade_me_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/trip_it_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/tsina_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/tumblr_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/twitter_spec.rb +20 -0
- data/oa-oauth/spec/omniauth/strategies/type_pad_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/vimeo_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/vkontakte_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/yahoo_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/yammer_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/you_tube_spec.rb +5 -0
- data/oa-oauth/spec/spec_helper.rb +27 -0
- data/oa-oauth/spec/support/shared_examples.rb +29 -0
- data/oa-openid/.gemtest +0 -0
- data/oa-openid/.rspec +3 -0
- data/oa-openid/.yardopts +4 -0
- data/oa-openid/LICENSE +19 -0
- data/oa-openid/README.rdoc +51 -0
- data/oa-openid/Rakefile +6 -0
- data/oa-openid/lib/oa-openid.rb +1 -0
- data/oa-openid/lib/omniauth/openid.rb +59 -0
- data/oa-openid/lib/omniauth/openid/gapps.rb +32 -0
- data/oa-openid/lib/omniauth/strategies/google_apps.rb +23 -0
- data/oa-openid/lib/omniauth/strategies/open_id.rb +132 -0
- data/oa-openid/lib/omniauth/version.rb +19 -0
- data/oa-openid/oa-openid.gemspec +29 -0
- data/oa-openid/spec/omniauth/strategies/open_id_spec.rb +71 -0
- data/oa-openid/spec/spec_helper.rb +14 -0
- data/omniauth.gemspec +3 -3
- data/tasks/all.rb +134 -0
- metadata +199 -9
- data/README.rdoc +0 -17
data/.autotest
ADDED
data/.document
ADDED
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
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
CHANGED
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
|
-
|
2
|
-
|
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
|
+
|
data/lib/omniauth/version.rb
CHANGED
@@ -1,5 +1,19 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
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
data/oa-basic/.yardopts
ADDED
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 @@
|
|
1
|
+
require 'omniauth/basic'
|
@@ -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
|