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.
- data/README.md +62 -34
- data/lib/omniauth/version.rb +2 -2
- metadata +59 -225
- data/.autotest +0 -9
- data/.document +0 -5
- data/.gemtest +0 -0
- data/.gitignore +0 -56
- data/.rspec +0 -2
- data/.travis.yml +0 -9
- data/.yardopts +0 -4
- data/Gemfile +0 -12
- data/Rakefile +0 -51
- data/oa-basic/.gemtest +0 -0
- data/oa-basic/.rspec +0 -3
- data/oa-basic/.yardopts +0 -4
- data/oa-basic/Gemfile +0 -7
- data/oa-basic/LICENSE +0 -19
- data/oa-basic/README.rdoc +0 -34
- data/oa-basic/Rakefile +0 -6
- data/oa-basic/lib/oa-basic.rb +0 -1
- data/oa-basic/lib/omniauth/basic.rb +0 -8
- data/oa-basic/lib/omniauth/strategies/http_basic.rb +0 -56
- data/oa-basic/lib/omniauth/version.rb +0 -19
- data/oa-basic/oa-basic.gemspec +0 -27
- data/oa-basic/spec/omniauth/strategies/basic_spec.rb +0 -7
- data/oa-basic/spec/spec_helper.rb +0 -11
- data/oa-core/.gemtest +0 -0
- data/oa-core/.rspec +0 -3
- data/oa-core/.yardopts +0 -4
- data/oa-core/Gemfile +0 -3
- data/oa-core/LICENSE +0 -19
- data/oa-core/Rakefile +0 -6
- data/oa-core/autotest/discover.rb +0 -1
- data/oa-core/lib/oa-core.rb +0 -1
- data/oa-core/lib/omniauth/builder.rb +0 -33
- data/oa-core/lib/omniauth/core.rb +0 -135
- data/oa-core/lib/omniauth/form.rb +0 -186
- data/oa-core/lib/omniauth/strategy.rb +0 -227
- data/oa-core/lib/omniauth/test/phony_session.rb +0 -8
- data/oa-core/lib/omniauth/test/strategy_macros.rb +0 -34
- data/oa-core/lib/omniauth/test/strategy_test_case.rb +0 -49
- data/oa-core/lib/omniauth/test.rb +0 -12
- data/oa-core/lib/omniauth/version.rb +0 -19
- data/oa-core/oa-core.gemspec +0 -24
- data/oa-core/spec/omniauth/builder_spec.rb +0 -20
- data/oa-core/spec/omniauth/core_spec.rb +0 -79
- data/oa-core/spec/omniauth/strategy_spec.rb +0 -363
- data/oa-core/spec/spec_helper.rb +0 -12
- data/oa-enterprise/.gemtest +0 -0
- data/oa-enterprise/.rspec +0 -3
- data/oa-enterprise/.yardopts +0 -4
- data/oa-enterprise/Gemfile +0 -7
- data/oa-enterprise/LICENSE +0 -19
- data/oa-enterprise/README.rdoc +0 -82
- data/oa-enterprise/Rakefile +0 -6
- data/oa-enterprise/lib/oa-enterprise.rb +0 -1
- data/oa-enterprise/lib/omniauth/enterprise.rb +0 -8
- data/oa-enterprise/lib/omniauth/strategies/cas/configuration.rb +0 -98
- data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +0 -91
- data/oa-enterprise/lib/omniauth/strategies/cas.rb +0 -47
- data/oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb +0 -279
- data/oa-enterprise/lib/omniauth/strategies/ldap.rb +0 -111
- data/oa-enterprise/lib/omniauth/version.rb +0 -19
- data/oa-enterprise/oa-enterprise.gemspec +0 -31
- data/oa-enterprise/spec/fixtures/cas_failure.xml +0 -4
- data/oa-enterprise/spec/fixtures/cas_success.xml +0 -8
- data/oa-enterprise/spec/omniauth/strategies/cas_spec.rb +0 -94
- data/oa-enterprise/spec/omniauth/strategies/ldap_spec.rb +0 -41
- data/oa-enterprise/spec/spec_helper.rb +0 -14
- data/oa-more/.gemtest +0 -0
- data/oa-more/.rspec +0 -3
- data/oa-more/.yardopts +0 -4
- data/oa-more/Gemfile +0 -7
- data/oa-more/LICENSE +0 -19
- data/oa-more/README.rdoc +0 -22
- data/oa-more/Rakefile +0 -6
- data/oa-more/lib/oa-more.rb +0 -1
- data/oa-more/lib/omniauth/more.rb +0 -11
- data/oa-more/lib/omniauth/strategies/draugiem.rb +0 -104
- data/oa-more/lib/omniauth/strategies/flickr.rb +0 -86
- data/oa-more/lib/omniauth/strategies/ign.rb +0 -93
- data/oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb +0 -1143
- data/oa-more/lib/omniauth/strategies/windows_live.rb +0 -39
- data/oa-more/lib/omniauth/strategies/yupoo.rb +0 -67
- data/oa-more/lib/omniauth/version.rb +0 -19
- data/oa-more/oa-more.gemspec +0 -29
- data/oa-more/spec/omniauth/strategies/draugiem_spec.rb +0 -51
- data/oa-more/spec/omniauth/strategies/flickr_spec.rb +0 -7
- data/oa-more/spec/spec_helper.rb +0 -11
- data/oa-oauth/.gemtest +0 -0
- data/oa-oauth/.rspec +0 -3
- data/oa-oauth/.yardopts +0 -4
- data/oa-oauth/Gemfile +0 -7
- data/oa-oauth/LICENSE +0 -19
- data/oa-oauth/README.rdoc +0 -35
- data/oa-oauth/Rakefile +0 -6
- data/oa-oauth/autotest/discover.rb +0 -1
- data/oa-oauth/lib/oa-oauth.rb +0 -1
- data/oa-oauth/lib/omniauth/oauth.rb +0 -56
- data/oa-oauth/lib/omniauth/strategies/bitly.rb +0 -46
- data/oa-oauth/lib/omniauth/strategies/dailymile.rb +0 -64
- data/oa-oauth/lib/omniauth/strategies/doit.rb +0 -60
- data/oa-oauth/lib/omniauth/strategies/dopplr.rb +0 -53
- data/oa-oauth/lib/omniauth/strategies/douban.rb +0 -60
- data/oa-oauth/lib/omniauth/strategies/evernote.rb +0 -54
- data/oa-oauth/lib/omniauth/strategies/facebook.rb +0 -70
- data/oa-oauth/lib/omniauth/strategies/foursquare.rb +0 -62
- data/oa-oauth/lib/omniauth/strategies/github.rb +0 -50
- data/oa-oauth/lib/omniauth/strategies/goodreads.rb +0 -44
- data/oa-oauth/lib/omniauth/strategies/google.rb +0 -80
- data/oa-oauth/lib/omniauth/strategies/gowalla.rb +0 -72
- data/oa-oauth/lib/omniauth/strategies/hyves.rb +0 -67
- data/oa-oauth/lib/omniauth/strategies/identica.rb +0 -49
- data/oa-oauth/lib/omniauth/strategies/instagram.rb +0 -56
- data/oa-oauth/lib/omniauth/strategies/instapaper.rb +0 -40
- data/oa-oauth/lib/omniauth/strategies/linked_in.rb +0 -56
- data/oa-oauth/lib/omniauth/strategies/mailru.rb +0 -107
- data/oa-oauth/lib/omniauth/strategies/meetup.rb +0 -56
- data/oa-oauth/lib/omniauth/strategies/miso.rb +0 -41
- data/oa-oauth/lib/omniauth/strategies/mixi.rb +0 -59
- data/oa-oauth/lib/omniauth/strategies/netflix.rb +0 -65
- data/oa-oauth/lib/omniauth/strategies/oauth.rb +0 -83
- data/oa-oauth/lib/omniauth/strategies/oauth2.rb +0 -91
- data/oa-oauth/lib/omniauth/strategies/plurk.rb +0 -58
- data/oa-oauth/lib/omniauth/strategies/qzone.rb +0 -69
- data/oa-oauth/lib/omniauth/strategies/rdio.rb +0 -45
- data/oa-oauth/lib/omniauth/strategies/renren.rb +0 -87
- data/oa-oauth/lib/omniauth/strategies/salesforce.rb +0 -44
- data/oa-oauth/lib/omniauth/strategies/smug_mug.rb +0 -42
- data/oa-oauth/lib/omniauth/strategies/sound_cloud.rb +0 -46
- data/oa-oauth/lib/omniauth/strategies/t163.rb +0 -57
- data/oa-oauth/lib/omniauth/strategies/taobao.rb +0 -79
- data/oa-oauth/lib/omniauth/strategies/teambox.rb +0 -49
- data/oa-oauth/lib/omniauth/strategies/thirty_seven_signals.rb +0 -41
- data/oa-oauth/lib/omniauth/strategies/tqq.rb +0 -64
- data/oa-oauth/lib/omniauth/strategies/trade_me.rb +0 -45
- data/oa-oauth/lib/omniauth/strategies/trip_it.rb +0 -22
- data/oa-oauth/lib/omniauth/strategies/tsina.rb +0 -79
- data/oa-oauth/lib/omniauth/strategies/tsohu.rb +0 -57
- data/oa-oauth/lib/omniauth/strategies/tumblr.rb +0 -60
- data/oa-oauth/lib/omniauth/strategies/twitter.rb +0 -57
- data/oa-oauth/lib/omniauth/strategies/type_pad.rb +0 -76
- data/oa-oauth/lib/omniauth/strategies/vimeo.rb +0 -54
- data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +0 -87
- data/oa-oauth/lib/omniauth/strategies/xauth.rb +0 -67
- data/oa-oauth/lib/omniauth/strategies/yahoo.rb +0 -55
- data/oa-oauth/lib/omniauth/strategies/yammer.rb +0 -43
- data/oa-oauth/lib/omniauth/strategies/you_tube.rb +0 -73
- data/oa-oauth/lib/omniauth/version.rb +0 -19
- data/oa-oauth/oa-oauth.gemspec +0 -32
- data/oa-oauth/spec/fixtures/basecamp_200.xml +0 -24
- data/oa-oauth/spec/fixtures/campfire_200.json +0 -10
- data/oa-oauth/spec/omniauth/strategies/bitly_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/dailymile_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/doit_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/dopplr_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/douban_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/evernote_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/facebook_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/foursquare_spec.rb +0 -18
- data/oa-oauth/spec/omniauth/strategies/github_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/goodreads_spec.rb +0 -6
- data/oa-oauth/spec/omniauth/strategies/google_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/gowalla_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/hyves_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/identica_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/linked_in_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/mailru_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/meetup_spec.rb +0 -14
- data/oa-oauth/spec/omniauth/strategies/miso_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/netflix_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/oauth2_spec.rb +0 -0
- data/oa-oauth/spec/omniauth/strategies/oauth_spec.rb +0 -77
- data/oa-oauth/spec/omniauth/strategies/plurk_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/rdio_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/salesforce_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/smug_mug_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/sound_cloud_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/t163_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/taobao_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/teambox_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/thirty_seven_signals_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/trade_me_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/trip_it_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/tsina_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/tumblr_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/twitter_spec.rb +0 -20
- data/oa-oauth/spec/omniauth/strategies/type_pad_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/vimeo_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/vkontakte_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/yahoo_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/yammer_spec.rb +0 -5
- data/oa-oauth/spec/omniauth/strategies/you_tube_spec.rb +0 -5
- data/oa-oauth/spec/spec_helper.rb +0 -27
- data/oa-oauth/spec/support/shared_examples.rb +0 -29
- data/oa-openid/.gemtest +0 -0
- data/oa-openid/.rspec +0 -3
- data/oa-openid/.yardopts +0 -4
- data/oa-openid/Gemfile +0 -7
- data/oa-openid/LICENSE +0 -19
- data/oa-openid/README.rdoc +0 -51
- data/oa-openid/Rakefile +0 -6
- data/oa-openid/lib/oa-openid.rb +0 -1
- data/oa-openid/lib/omniauth/openid/gapps.rb +0 -32
- data/oa-openid/lib/omniauth/openid.rb +0 -60
- data/oa-openid/lib/omniauth/strategies/google_apps.rb +0 -23
- data/oa-openid/lib/omniauth/strategies/open_id.rb +0 -132
- data/oa-openid/lib/omniauth/strategies/steam.rb +0 -55
- data/oa-openid/lib/omniauth/version.rb +0 -19
- data/oa-openid/oa-openid.gemspec +0 -28
- data/oa-openid/spec/omniauth/strategies/open_id_spec.rb +0 -71
- data/oa-openid/spec/spec_helper.rb +0 -14
- data/omniauth.gemspec +0 -20
- data/tasks/all.rb +0 -134
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Based heavily on the Google strategy, monkeypatch and all
|
|
2
|
-
|
|
3
|
-
require 'omniauth/oauth'
|
|
4
|
-
require 'multi_json'
|
|
5
|
-
|
|
6
|
-
module OmniAuth
|
|
7
|
-
module Strategies
|
|
8
|
-
#
|
|
9
|
-
# Authenticate to YouTube via OAuth and retrieve basic user info.
|
|
10
|
-
#
|
|
11
|
-
# Usage:
|
|
12
|
-
#
|
|
13
|
-
# use OmniAuth::Strategies::YouTube, 'consumerkey', 'consumersecret'
|
|
14
|
-
#
|
|
15
|
-
class YouTube < OmniAuth::Strategies::OAuth
|
|
16
|
-
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
|
17
|
-
client_options = {
|
|
18
|
-
:site => 'https://www.google.com',
|
|
19
|
-
:request_token_path => '/accounts/OAuthGetRequestToken',
|
|
20
|
-
:access_token_path => '/accounts/OAuthGetAccessToken',
|
|
21
|
-
:authorize_path => '/accounts/OAuthAuthorizeToken'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
super(app, :you_tube, consumer_key, consumer_secret, client_options, options)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def auth_hash
|
|
28
|
-
ui = user_info
|
|
29
|
-
OmniAuth::Utils.deep_merge(super, {
|
|
30
|
-
'uid' => ui['uid'],
|
|
31
|
-
'user_info' => ui,
|
|
32
|
-
'extra' => {'user_hash' => user_hash}
|
|
33
|
-
})
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def user_info
|
|
37
|
-
entry = user_hash['entry']
|
|
38
|
-
{
|
|
39
|
-
'uid' => entry['id']['$t'],
|
|
40
|
-
'nickname' => entry['author'].first['name']['$t'],
|
|
41
|
-
'first_name' => entry['yt$firstName'] && entry['yt$firstName']['$t'],
|
|
42
|
-
'last_name' => entry['yt$lastName'] && entry['yt$lastName']['$t'],
|
|
43
|
-
'image' => entry['media$thumbnail'] && entry['media$thumbnail']['url'],
|
|
44
|
-
'description' => entry['yt$description'] && entry['yt$description']['$t'],
|
|
45
|
-
'location' => entry['yt$location'] && entry['yt$location']['$t']
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def user_hash
|
|
50
|
-
# YouTube treats 'default' as the currently logged-in user
|
|
51
|
-
# via http://apiblog.youtube.com/2010/11/update-to-clientlogin-url.html
|
|
52
|
-
@user_hash ||= MultiJson.decode(@access_token.get("http://gdata.youtube.com/feeds/api/users/default?alt=json").body)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Monkeypatch consumer.get_request_token but specify YouTube scope rather than Google Contacts
|
|
56
|
-
# TODO this is an easy patch to the underlying OAuth strategy a la OAuth2
|
|
57
|
-
def request_phase
|
|
58
|
-
request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => 'http://gdata.youtube.com'})
|
|
59
|
-
session['oauth'] ||= {}
|
|
60
|
-
session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
|
|
61
|
-
r = Rack::Response.new
|
|
62
|
-
|
|
63
|
-
if request_token.callback_confirmed?
|
|
64
|
-
r.redirect(request_token.authorize_url)
|
|
65
|
-
else
|
|
66
|
-
r.redirect(request_token.authorize_url(:oauth_callback => callback_url))
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
r.finish
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
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
|
data/oa-oauth/oa-oauth.gemspec
DELETED
|
@@ -1,32 +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 'faraday', '~> 0.6.1'
|
|
6
|
-
gem.add_runtime_dependency 'multi_json', '~> 1.0.0'
|
|
7
|
-
gem.add_runtime_dependency 'multi_xml', '~> 0.2.2'
|
|
8
|
-
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
|
|
9
|
-
gem.add_runtime_dependency 'oauth', '~> 0.4.0'
|
|
10
|
-
gem.add_runtime_dependency 'oauth2', '~> 0.4.1'
|
|
11
|
-
gem.add_development_dependency 'evernote', '~> 0.9'
|
|
12
|
-
gem.add_development_dependency 'maruku', '~> 0.6'
|
|
13
|
-
gem.add_development_dependency 'rack-test', '~> 0.5'
|
|
14
|
-
gem.add_development_dependency 'rake', '~> 0.8'
|
|
15
|
-
gem.add_development_dependency 'rspec', '~> 2.5'
|
|
16
|
-
gem.add_development_dependency 'simplecov', '~> 0.4'
|
|
17
|
-
gem.add_development_dependency 'webmock', '~> 1.6'
|
|
18
|
-
gem.add_development_dependency 'yard', '~> 0.7'
|
|
19
|
-
gem.add_development_dependency 'ZenTest', '~> 4.5'
|
|
20
|
-
gem.name = 'oa-oauth'
|
|
21
|
-
gem.version = OmniAuth::Version::STRING
|
|
22
|
-
gem.description = %q{OAuth strategies for OmniAuth.}
|
|
23
|
-
gem.summary = gem.description
|
|
24
|
-
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
|
|
25
|
-
gem.homepage = 'http://github.com/intridea/omniauth'
|
|
26
|
-
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
|
|
27
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
|
28
|
-
gem.files = `git ls-files`.split("\n")
|
|
29
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
30
|
-
gem.require_paths = ['lib']
|
|
31
|
-
gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
|
|
32
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<person>
|
|
2
|
-
<client-id type="integer">0</client-id>
|
|
3
|
-
<created-at type="datetime">2008-08-14T00:00:00Z</created-at>
|
|
4
|
-
<id type="integer">1827370</id>
|
|
5
|
-
<im-handle/>
|
|
6
|
-
<im-service>AOL</im-service>
|
|
7
|
-
<phone-number-fax/>
|
|
8
|
-
<phone-number-home/>
|
|
9
|
-
<phone-number-mobile/>
|
|
10
|
-
<phone-number-office/>
|
|
11
|
-
<phone-number-office-ext/>
|
|
12
|
-
<title/>
|
|
13
|
-
<token>5fc2ab4f6c2f9cdf12ed01b88e7554f8ad21bbfb</token>
|
|
14
|
-
<updated-at type="datetime">2010-05-24T11:59:34Z</updated-at>
|
|
15
|
-
<uuid>b11312ca-227d-36fd-e3b5-af2f419-a650</uuid>
|
|
16
|
-
<first-name>Sally</first-name>
|
|
17
|
-
<last-name>Fried</last-name>
|
|
18
|
-
<company-id type="integer">1042368</company-id>
|
|
19
|
-
<user-name/>
|
|
20
|
-
<email-address>sfried@example.org</email-address>
|
|
21
|
-
<avatar-url>
|
|
22
|
-
http://asset3.37img.com/75521bbf128b89b7ec2ab5fe98ad21b4f6ad21e/avatar.png?r=3
|
|
23
|
-
</avatar-url>
|
|
24
|
-
</person>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
|
2
|
-
|
|
3
|
-
describe OmniAuth::Strategies::Foursquare do
|
|
4
|
-
it_should_behave_like "an oauth2 strategy"
|
|
5
|
-
subject{ OmniAuth::Strategies::Foursquare.new(lambda{|env|[200,{},[""]]} , 'abc', 'def')}
|
|
6
|
-
|
|
7
|
-
it 'should use the mobile authorize url when :mobile is true' do
|
|
8
|
-
subject.authorize_url(:mobile => true).should be_include("/mobile/")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it 'should use the authorize endpoint if :sign_in is false' do
|
|
12
|
-
subject.authorize_url(:sign_in => false).should be_include("/authorize")
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'should default to the authenticate endpoint' do
|
|
16
|
-
subject.client.authorize_url.should be_include('/authenticate')
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
|
2
|
-
|
|
3
|
-
describe OmniAuth::Strategies::Meetup do
|
|
4
|
-
it_should_behave_like 'an oauth strategy'
|
|
5
|
-
it 'should use the authenticate (sign in) path by default' do
|
|
6
|
-
s = strategy_class.new(app, 'abc', 'def')
|
|
7
|
-
s.consumer.options[:authorize_path].should == 'http://www.meetup.com/authenticate'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should use the authorize path if :sign_in is false' do
|
|
11
|
-
s = strategy_class.new(app, 'abc', 'def', :sign_in => false)
|
|
12
|
-
s.consumer.options[:authorize_path].should == 'http://www.meetup.com/authorize'
|
|
13
|
-
end
|
|
14
|
-
end
|
|
File without changes
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
|
2
|
-
|
|
3
|
-
describe "OmniAuth::Strategies::OAuth" do
|
|
4
|
-
|
|
5
|
-
def app
|
|
6
|
-
Rack::Builder.new {
|
|
7
|
-
use OmniAuth::Test::PhonySession
|
|
8
|
-
use OmniAuth::Builder do
|
|
9
|
-
provider :oauth, 'example.org', 'abc', 'def', :site => 'https://api.example.org'
|
|
10
|
-
provider :oauth, 'example.org_with_authorize_params', 'abc', 'def', { :site => 'https://api.example.org' }, :authorize_params => {:abc => 'def'}
|
|
11
|
-
end
|
|
12
|
-
run lambda { |env| [404, {'Content-Type' => 'text/plain'}, [env.key?('omniauth.auth').to_s]] }
|
|
13
|
-
}.to_app
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def session
|
|
17
|
-
last_request.env['rack.session']
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
stub_request(:post, 'https://api.example.org/oauth/request_token').
|
|
22
|
-
to_return(:body => "oauth_token=yourtoken&oauth_token_secret=yoursecret&oauth_callback_confirmed=true")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe '/auth/{name}' do
|
|
26
|
-
before do
|
|
27
|
-
get '/auth/example.org'
|
|
28
|
-
end
|
|
29
|
-
it 'should redirect to authorize_url' do
|
|
30
|
-
last_response.should be_redirect
|
|
31
|
-
last_response.headers['Location'].should == 'https://api.example.org/oauth/authorize?oauth_token=yourtoken'
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'should redirect to authorize_url with authorize_params when set' do
|
|
35
|
-
get '/auth/example.org_with_authorize_params'
|
|
36
|
-
last_response.should be_redirect
|
|
37
|
-
[
|
|
38
|
-
'https://api.example.org/oauth/authorize?abc=def&oauth_token=yourtoken',
|
|
39
|
-
'https://api.example.org/oauth/authorize?oauth_token=yourtoken&abc=def'
|
|
40
|
-
].should be_include(last_response.headers['Location'])
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'should set appropriate session variables' do
|
|
44
|
-
session['oauth'].should == {"example.org" => {'callback_confirmed' => true, 'request_token' => 'yourtoken', 'request_secret' => 'yoursecret'}}
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe '/auth/{name}/callback' do
|
|
49
|
-
before do
|
|
50
|
-
stub_request(:post, 'https://api.example.org/oauth/access_token').
|
|
51
|
-
to_return(:body => "oauth_token=yourtoken&oauth_token_secret=yoursecret")
|
|
52
|
-
get '/auth/example.org/callback', {:oauth_verifier => 'dudeman'}, {'rack.session' => {'oauth' => {"example.org" => {'callback_confirmed' => true, 'request_token' => 'yourtoken', 'request_secret' => 'yoursecret'}}}}
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it 'should exchange the request token for an access token' do
|
|
56
|
-
last_request.env['omniauth.auth']['provider'].should == 'example.org'
|
|
57
|
-
last_request.env['omniauth.auth']['extra']['access_token'].should be_kind_of(OAuth::AccessToken)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
it 'should call through to the master app' do
|
|
61
|
-
last_response.body.should == 'true'
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
context "bad gateway (or any 5xx) for access_token" do
|
|
65
|
-
before do
|
|
66
|
-
stub_request(:post, 'https://api.example.org/oauth/access_token').
|
|
67
|
-
to_raise(::Net::HTTPFatalError.new(%Q{502 "Bad Gateway"}, nil))
|
|
68
|
-
get '/auth/example.org/callback', {:oauth_verifier => 'dudeman'}, {'rack.session' => {'oauth' => {"example.org" => {'callback_confirmed' => true, 'request_token' => 'yourtoken', 'request_secret' => 'yoursecret'}}}}
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'should call fail! with :service_unavailable' do
|
|
72
|
-
last_request.env['omniauth.error'].should be_kind_of(::Net::HTTPFatalError)
|
|
73
|
-
last_request.env['omniauth.error.type'] = :service_unavailable
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
|
2
|
-
|
|
3
|
-
describe OmniAuth::Strategies::Twitter do
|
|
4
|
-
it_should_behave_like 'an oauth strategy'
|
|
5
|
-
|
|
6
|
-
it 'should use the authenticate (sign in) path by default' do
|
|
7
|
-
s = strategy_class.new(app, 'abc', 'def')
|
|
8
|
-
s.consumer.options[:authorize_path].should == '/oauth/authenticate'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it 'should set options[:authorize_params] to { :force_login => "true" } if :force_login is true' do
|
|
12
|
-
s = strategy_class.new(app, 'abc', 'def', :force_login => true)
|
|
13
|
-
s.options[:authorize_params].should == { :force_login => 'true' }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it 'should use the authorize path if :sign_in is false' do
|
|
17
|
-
s = strategy_class.new(app, 'abc', 'def', :sign_in => false)
|
|
18
|
-
s.consumer.options[:authorize_path].should == '/oauth/authorize'
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,27 +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/oauth'
|
|
9
|
-
require File.expand_path('../support/shared_examples', __FILE__)
|
|
10
|
-
|
|
11
|
-
RSpec.configure do |config|
|
|
12
|
-
config.include WebMock::API
|
|
13
|
-
config.include Rack::Test::Methods
|
|
14
|
-
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def strategy_class
|
|
18
|
-
meta = self.class.metadata
|
|
19
|
-
while meta.key?(:example_group)
|
|
20
|
-
meta = meta[:example_group]
|
|
21
|
-
end
|
|
22
|
-
meta[:describes]
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def app
|
|
26
|
-
lambda{|env| [200, {}, ['Hello']]}
|
|
27
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
shared_examples_for "an oauth strategy" do
|
|
2
|
-
it 'should be initializable with only three arguments' do
|
|
3
|
-
lambda{ strategy_class.new(lambda{|env| [200, {}, ['Hello World']]}, 'key', 'secret') }.should_not raise_error
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
it 'should be initializable with a block' do
|
|
7
|
-
lambda{ strategy_class.new(lambda{|env| [200, {}, ['Hello World']]}){|s| s.consumer_key = 'abc'} }.should_not raise_error
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should handle the setting of client options' do
|
|
11
|
-
s = strategy_class.new(lambda{|env| [200, {}, ['Hello World']]}, 'key', 'secret', :client_options => {:abc => 'def'})
|
|
12
|
-
s.consumer.options[:abc].should == 'def'
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
shared_examples_for "an oauth2 strategy" do
|
|
17
|
-
it 'should be initializable with only three arguments' do
|
|
18
|
-
lambda{ strategy_class.new(lambda{|env| [200, {}, ['Hello World']]}, 'key', 'secret') }.should_not raise_error
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should be initializable with a block' do
|
|
22
|
-
lambda{ strategy_class.new(lambda{|env| [200, {}, ['Hello World']]}){|s| s.client_id = 'abc'} }.should_not raise_error
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'should handle the setting of client options' do
|
|
26
|
-
s = strategy_class.new(lambda{|env| [200, {}, ['Hello World']]}, 'key', 'secret', :client_options => {:abc => 'def'})
|
|
27
|
-
s.client.options[:abc].should == 'def'
|
|
28
|
-
end
|
|
29
|
-
end
|
data/oa-openid/.gemtest
DELETED
|
File without changes
|
data/oa-openid/.rspec
DELETED
data/oa-openid/.yardopts
DELETED