Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0 3 stable #587

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
485b9e3
first revision of etsy authentication
Aug 9, 2011
2ee9739
remove unnecessary whitespace
Aug 9, 2011
b918f07
adding spec file for etsy
Aug 9, 2011
c608937
changing vesion to 0.2.6.1.copious
Aug 9, 2011
dd98c29
Backporting facebook oauth2 code from omniauth 0.3 (head) to fix http…
Aug 10, 2011
e1f5445
set etsy environment to correctly set host; use correct host; bump ve…
Aug 24, 2011
0aa9452
Replacing Yammer OAuth with the new OAuth2
bruno Sep 10, 2011
2bfb889
Fixed the missing space for google email scope
soorajb Sep 11, 2011
a9598ee
Merge pull request #463 from roadly/0-3-stable
sferik Sep 11, 2011
67bcf5e
Added support for Facebook signed_request.
umairsiddique Sep 12, 2011
4e75459
Fixed Goodreads strategy to work. (MultiXml returns a hash.)
gruen Sep 15, 2011
1512c2c
Fixed typo on method definition.
gruen Sep 15, 2011
510c420
fixed method header
gruen Sep 15, 2011
9137efd
Update multi_xml dependency to version 0.4.0
sferik Sep 15, 2011
e22e77d
Fix syntax error on Ruby 1.8
sferik Sep 15, 2011
2fb469b
Make sure query params are copied over to omniauth.params in test mode.
Sep 19, 2011
632f941
allow SAML strategy to have a custom name
rwilcox Sep 20, 2011
48d4d71
Merge pull request #473 from gruen/0-3-stable
Sep 22, 2011
d0f1e72
Merge pull request #468 from soorajb/master
Sep 22, 2011
58d5e14
Switch twitter back to /authenticate, Closes #466, Closes #478
Sep 22, 2011
cc3391b
Fix Twitter spec. How did that default get flipped anyway?
Sep 22, 2011
bf02226
Bump version to 0.3.0
Sep 22, 2011
80788e2
add XING strategy
Sep 27, 2011
84b75d0
Merge pull request #488 from roccoblues/add_xing_strategy
Sep 27, 2011
42d7056
add attributes (from the AttributeStatement parent) to the ominauth e…
rwilcox Oct 7, 2011
7fb89f4
add attributes (from the AttributeStatement parent) to the ominauth e…
rwilcox Oct 7, 2011
72ca833
Added MySpace strategy
Oct 11, 2011
a560b51
fix tests
Oct 13, 2011
a0abb77
set OAuth header so salesforce user query doesnt error out
Oct 13, 2011
daa6097
Merge pull request #505 from bradrobertson/0-3-stable
Oct 14, 2011
2ef48ea
Merge pull request #497 from rwilcox/add_saml_attributes_to_extra_hash
Oct 14, 2011
94c7b29
Merge pull request #476 from rwilcox/add_name_option_to_saml_strategy
Oct 14, 2011
49898b5
Merge pull request #469 from umairsiddique/0-3-stable
Oct 14, 2011
ccad9fa
Merge pull request #501 from chriswarren/0-3-stable
Oct 14, 2011
7ea4a47
gowalla fix
altuure Oct 15, 2011
2447925
Merge pull request #506 from altuure/0-3-stable
sferik Oct 15, 2011
d403418
added authorize_params to monkeypatch in google strategy
philspitler Oct 18, 2011
d9d9e9d
Merge pull request #508 from philspitler/0-3-stable
Oct 18, 2011
1f280a5
Stop swallowing OAuth2::Error when building access token.
josevalim Oct 19, 2011
cb40c88
Merge pull request #509 from josevalim/patch-1
sferik Oct 19, 2011
006d3cc
make possible to set custom route name for google_oauth2 strategy
sumskyi Oct 19, 2011
1f51502
Merge pull request #511 from sumskyi/0-3-stable
sferik Oct 19, 2011
8b72f29
stop rescuing all OAuth2::Errors and re-raising as RuntimeErrors
mkdynamic Oct 20, 2011
3cb973f
Merge pull request #513 from mkdynamic/0-3-stable
sferik Oct 20, 2011
729b892
fixed thirty_seven_signals strategy
krzyzak Oct 20, 2011
20a0e18
Merge pull request #514 from krzyzak/0-3-stable
Oct 20, 2011
cf5dae6
add email address to user_info hash in xing strategy
Oct 20, 2011
6d20b1b
Merge pull request #515 from roccoblues/0-3-stable
sferik Oct 20, 2011
b15870d
Bump version to 0.3.1
sferik Oct 20, 2011
05a76de
Bump version to 0.3.2
sferik Oct 20, 2011
3aff8a3
Make release script compatible with Ruby 1.8
sferik Oct 20, 2011
efa1948
Make instagram strategy fetch user data from full url. Fixes #431
bdotdub Oct 21, 2011
6c1f4db
Merge pull request #517 from bdotdub/0-3-stable
Oct 21, 2011
cb50883
Merge branch 'copious' of github.com:dlamacchia/omniauth into dev
Oct 28, 2011
0743594
update version to 0.3.2.1.copious
Oct 28, 2011
807d456
patch for copious version
Oct 29, 2011
6378a03
Remove copious-specific versioning
Oct 31, 2011
9126d82
Revert copious-specific version changes
Oct 31, 2011
a1d3953
Fix whitespace issues
Oct 31, 2011
88e6d7e
Merge pull request #527 from dlamacchia/0.3.2-stable-merge
Oct 31, 2011
19a9497
oauth specification fix for xing strategy is no longer needed
Nov 2, 2011
d7fbd61
Merge pull request #475 from pivotaldinamundo/0-3-stable
Nov 2, 2011
15b3492
Merge pull request #530 from roccoblues/update_xing_strategy
Nov 2, 2011
bb9df62
some fixes for mixi strategy
ainoya Nov 6, 2011
d1e5b8a
Merge pull request #535 from ufssf/mixiStrategyFix
Nov 6, 2011
959c850
Dropbox requires use of api version 1
BRIMIL01 Nov 17, 2011
1d3cb25
Merge pull request #541 from BRIMIL01/patch-1
Nov 17, 2011
a900def
Added support for Mendeley oauth authentication
abbottry Mar 9, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/omniauth/version.rb
Expand Up @@ -7,10 +7,10 @@ module Version
MINOR = 3
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 0
PATCH = 2
end
unless defined?(::OmniAuth::Version::PRE)
PRE = "rc1"
PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
Expand Down
4 changes: 2 additions & 2 deletions oa-basic/lib/omniauth/version.rb
Expand Up @@ -7,10 +7,10 @@ module Version
MINOR = 3
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 0
PATCH = 2
end
unless defined?(::OmniAuth::Version::PRE)
PRE = "rc1"
PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
Expand Down
9 changes: 7 additions & 2 deletions oa-core/lib/omniauth/strategy.rb
Expand Up @@ -107,6 +107,7 @@ def mock_callback_call
@env['omniauth.auth'] = mocked_auth
@env['omniauth.origin'] = session.delete('omniauth.origin')
@env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
copy_query_params
call_app!
end
end
Expand All @@ -124,10 +125,14 @@ def request_phase
raise NotImplementedError
end

def callback_phase
@env['omniauth.auth'] = auth_hash
def copy_query_params
@env['omniauth.params'] = session['query_params'] || {}
session['query_params'] = nil if session['query_params']
end

def callback_phase
@env['omniauth.auth'] = auth_hash
copy_query_params
call_app!
end

Expand Down
4 changes: 2 additions & 2 deletions oa-core/lib/omniauth/version.rb
Expand Up @@ -7,10 +7,10 @@ module Version
MINOR = 3
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 0
PATCH = 2
end
unless defined?(::OmniAuth::Version::PRE)
PRE = "rc1"
PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
Expand Down
22 changes: 12 additions & 10 deletions oa-enterprise/lib/omniauth/strategies/saml.rb
Expand Up @@ -8,11 +8,11 @@ class SAML
autoload :AuthResponse, 'omniauth/strategies/saml/auth_response'
autoload :ValidationError, 'omniauth/strategies/saml/validation_error'
autoload :XMLSecurity, 'omniauth/strategies/saml/xml_security'

@@settings = {}

def initialize(app, options={})
super(app, :saml)
super( app, (options[:name] || :saml) )
@@settings = {
:assertion_consumer_service_url => options[:assertion_consumer_service_url],
:issuer => options[:issuer],
Expand All @@ -21,30 +21,32 @@ def initialize(app, options={})
:name_identifier_format => options[:name_identifier_format] || "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
}
end

def request_phase
request = OmniAuth::Strategies::SAML::AuthRequest.new
redirect(request.create(@@settings))
end

def callback_phase
begin
response = OmniAuth::Strategies::SAML::AuthResponse.new(request.params['SAMLResponse'])
response.settings = @@settings
@name_id = response.name_id
@extra_attributes = response.attributes
return fail!(:invalid_ticket, 'Invalid SAML Ticket') if @name_id.nil? || @name_id.empty?
super
rescue ArgumentError => e
fail!(:invalid_ticket, 'Invalid SAML Response')
end
end
end

def auth_hash
OmniAuth::Utils.deep_merge(super, {
'uid' => @name_id
'uid' => @name_id,
'extra' => @extra_attributes
})
end
end

end
end
end
4 changes: 2 additions & 2 deletions oa-enterprise/lib/omniauth/version.rb
Expand Up @@ -7,10 +7,10 @@ module Version
MINOR = 3
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 0
PATCH = 2
end
unless defined?(::OmniAuth::Version::PRE)
PRE = "rc1"
PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
Expand Down
4 changes: 2 additions & 2 deletions oa-more/lib/omniauth/version.rb
Expand Up @@ -7,10 +7,10 @@ module Version
MINOR = 3
end
unless defined?(::OmniAuth::Version::PATCH)
PATCH = 0
PATCH = 2
end
unless defined?(::OmniAuth::Version::PRE)
PRE = "rc1"
PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
Expand Down
7 changes: 5 additions & 2 deletions oa-oauth/lib/omniauth/oauth.rb
Expand Up @@ -7,6 +7,7 @@ module Strategies
autoload :Dopplr, 'omniauth/strategies/oauth/dopplr'
autoload :Douban, 'omniauth/strategies/oauth/douban'
autoload :Dropbox, 'omniauth/strategies/oauth/dropbox'
autoload :Etsy, 'omniauth/strategies/oauth/etsy'
autoload :Evernote, 'omniauth/strategies/oauth/evernote'
autoload :Flattr, 'omniauth/strategies/oauth/flattr'
autoload :Flickr, 'omniauth/strategies/oauth/flickr'
Expand All @@ -19,6 +20,7 @@ module Strategies
autoload :LinkedIn, 'omniauth/strategies/oauth/linked_in'
autoload :Meetup, 'omniauth/strategies/oauth/meetup'
autoload :Miso, 'omniauth/strategies/oauth/miso'
autoload :MySpace, 'omniauth/strategies/oauth/my_space'
autoload :Netflix, 'omniauth/strategies/oauth/netflix'
autoload :Orkut, 'omniauth/strategies/oauth/orkut'
autoload :Qzone, 'omniauth/strategies/oauth/qzone'
Expand All @@ -36,8 +38,8 @@ module Strategies
autoload :TypePad, 'omniauth/strategies/oauth/type_pad'
autoload :Vimeo, 'omniauth/strategies/oauth/vimeo'
autoload :Yahoo, 'omniauth/strategies/oauth/yahoo'
autoload :Yammer, 'omniauth/strategies/oauth/yammer'
autoload :YouTube, 'omniauth/strategies/oauth/you_tube'
autoload :Xing, 'omniauth/strategies/oauth/xing'

autoload :OAuth2, 'omniauth/strategies/oauth2'
autoload :AngelList, 'omniauth/strategies/oauth2/angellist'
Expand Down Expand Up @@ -65,10 +67,11 @@ module Strategies
autoload :Viadeo, 'omniauth/strategies/oauth2/viadeo'
autoload :Vkontakte, 'omniauth/strategies/oauth2/vkontakte'
autoload :WePay, 'omniauth/strategies/oauth2/we_pay'
autoload :Yammer, 'omniauth/strategies/oauth2/yammer'


autoload :XAuth, 'omniauth/strategies/xauth'
autoload :Instapaper, 'omniauth/strategies/xauth/instapaper'

end
end
4 changes: 2 additions & 2 deletions oa-oauth/lib/omniauth/strategies/google_oauth2.rb
Expand Up @@ -16,13 +16,13 @@ def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
:token_url => '/o/oauth2/token'
}

super(app, :google_oauth2, client_id, client_secret, client_options, options, &block)
super(app, (options[:name] || :google_oauth2), client_id, client_secret, client_options, options, &block)
end

def request_phase
google_email_scope = "www.googleapis.com/auth/userinfo.email"
options[:scope] ||= "https://#{google_email_scope}"
options[:scope] << "https://#{google_email_scope}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}]
options[:scope] << " https://#{google_email_scope}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}]
redirect client.auth_code.authorize_url(
{:redirect_uri => callback_url, :response_type => "code"}.merge(options))
end
Expand Down
8 changes: 4 additions & 4 deletions oa-oauth/lib/omniauth/strategies/oauth/dropbox.rb
Expand Up @@ -6,10 +6,10 @@ module Strategies
class Dropbox < OmniAuth::Strategies::OAuth
def initialize(app, consumer_key=nil, consumer_secret=nil, options={}, &block)
client_options = {
:authorize_url => 'https://www.dropbox.com/0/oauth/authorize',
:access_token_url => 'https://api.dropbox.com/0/oauth/access_token',
:authorize_url => 'https://www.dropbox.com/1/oauth/authorize',
:access_token_url => 'https://api.dropbox.com/1/oauth/access_token',
:proxy => ENV['HTTP_PROXY'] || ENV['http_proxy'],
:request_token_url => 'https://api.dropbox.com/0/oauth/request_token',
:request_token_url => 'https://api.dropbox.com/1/oauth/request_token',
:site => 'https://api.dropbox.com',
}
super(app, :dropbox, consumer_key, consumer_secret, client_options, options, &block)
Expand All @@ -25,7 +25,7 @@ def auth_hash
end

def user_data
@data ||= MultiJson.decode(@access_token.get('/0/account/info').body)
@data ||= MultiJson.decode(@access_token.get('/1/account/info').body)
end

def user_info
Expand Down
106 changes: 106 additions & 0 deletions oa-oauth/lib/omniauth/strategies/oauth/etsy.rb
@@ -0,0 +1,106 @@
require 'omniauth/oauth'
require 'multi_json'

module OmniAuth
module Strategies
class Etsy < OmniAuth::Strategies::OAuth

# Cribbed from the etsy gem.
SANDBOX_HOST = 'sandbox.openapi.etsy.com'
PRODUCTION_HOST = 'openapi.etsy.com'

# Set the environment, accepts either :sandbox or :production. Defaults to :production
# and will raise an exception when set to an unrecognized environment.
def self.environment=(environment)
unless [:sandbox, :production].include?(environment)
raise(ArgumentError, "environment must be set to either :sandbox or :production")
end
@environment = environment
@host = (environment == :sandbox) ? SANDBOX_HOST : PRODUCTION_HOST
end

# The currently configured environment.
def self.environment
@environment || :production
end

def self.host # :nodoc:
@host || PRODUCTION_HOST
end

def self.callback_url
@callback_url || 'oob'
end

def initialize(app, consumer_key=nil, consumer_secret=nil, options={}, &block)
# Set environment first; this can update our host
OmniAuth::Strategies::Etsy.environment=options[:environment] if options[:environment]
client_options = {
:site => "http://#{OmniAuth::Strategies::Etsy.host}",
:request_token_path => request_token_path(options),
:access_token_path => access_token_path,
:http_method => :get,
:scheme => :query_string
}

super(app, :etsy, consumer_key, consumer_secret, client_options, options, &block)
end

def request_phase
request_token = consumer.get_request_token(:oauth_callback => callback_url)
session['oauth'] ||= {}
session['oauth'][name.to_s] = {'callback_confirmed' => true, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
r = Rack::Response.new
if request_token.params[:login_url]
# Already contains token, etc, of the form:
# https://www.etsy.com/oauth/signin?oauth_consumer_key=wg30ji4z8kdzsymfkw9vm333&oauth_token=650a9d4a8d589bb7e6aefed1628885&service=v2_prod
r.redirect(request_token.params[:login_url])
end
r.finish
end

def auth_hash
OmniAuth::Utils.deep_merge(super, {
'uid' => user_hash['user_id'],
'user_info' => user_info,
'extra' => { 'user_hash' => user_hash }
})
end

def user_info
return {} unless user_hash
{
'uid' => user_hash['user_id'],
'nickname' => user_hash['login_name'],
'email' => user_hash['primary_email'],
'name' => user_hash['login_name'],
'feedback_info' => user_hash['feedback_info']
}
end

def request_token_path(options)
# Default scope is to read a user's private profile information, including email. Scope is specified
# as a uri-encoded query kv pair, "scope=scope_1+scope_2+...+scope_n"
# For a full list of scope options, see:
# http://www.etsy.com/developers/documentation/getting_started/oauth
"/v2/oauth/request_token?#{to_params({:scope => options.fetch(:scope, 'profile_r+email_r')})}"
end

def access_token_path
"/v2/oauth/access_token"
end

def to_params(options)
options.collect{|key, value| "#{key}=#{value}"}.join('&')
end

def user_hash
@user_hash ||= MultiJson.decode(@access_token.get('/v2/users/__SELF__').body)['results'][0]
rescue ::Errno::ETIMEDOUT
raise ::Timeout::Error
rescue ::OAuth::Error => e
raise e.response.inspect
end
end
end
end
20 changes: 10 additions & 10 deletions oa-oauth/lib/omniauth/strategies/oauth/goodreads.rb
Expand Up @@ -24,19 +24,19 @@ def auth_hash
end

def user_info(access_token)
authenticated_user = MultiXml.parse(@access_token.get('/api/auth_user').body)
id = authenticated_user.xpath('GoodreadsResponse/user').attribute('id').value.to_i
response_doc = MultiXml.parse(open("http://www.goodreads.com/user/show/#{id}.xml?key=#{@consumer_key}").read)
user = response_doc.xpath('GoodreadsResponse/user')
authenticated_user = MultiXml.parse(access_token.get('/api/auth_user').body)
id = authenticated_user['GoodreadsResponse']['user']['id'].to_i
response_doc = MultiXml.parse(access_token.get("/user/show/#{id}.xml?key=#{@consumer_key}").body)
user = response_doc['GoodreadsResponse']['user']

hash = {
'id' => id,
'name' => user.xpath('name').text,
'user_name' => user.xpath('user_name').text,
'image_url' => user.xpath('image_url').text,
'about' => user.xpath('about').text,
'location' => user.xpath('location').text,
'website' => user.xpath('website').text,
'name' => user['name'],
'user_name' => user['user_name'],
'image_url' => user['image_url'],
'about' => user['about'],
'location' => user['location'],
'website' => user['website'],
}
end
end
Expand Down
7 changes: 5 additions & 2 deletions oa-oauth/lib/omniauth/strategies/oauth/google.rb
Expand Up @@ -59,9 +59,12 @@ def user_hash
@user_hash ||= MultiJson.decode(@access_token.get('https://www.google.com/m8/feeds/contacts/default/full?max-results=1&alt=json').body)
end

# Monkeypatch OmniAuth to pass the scope in the consumer.get_request_token call
# Monkeypatch OmniAuth to pass the scope and authorize_params in the consumer.get_request_token call
def request_phase
request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => options[:scope]})
request_options = {:scope => options[:scope]}
request_options.merge!(options[:authorize_params])

request_token = consumer.get_request_token({:oauth_callback => callback_url}, request_options)
session['oauth'] ||= {}
session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
r = Rack::Response.new
Expand Down