From f5ebc31802e77891a800e096ab844388e54ae25a Mon Sep 17 00:00:00 2001 From: Cameron Hurst Date: Sun, 1 May 2011 16:41:00 -0400 Subject: [PATCH 01/31] Added the ability to add arbitrary HTML head information to the Omniauth.form --- oa-core/lib/omniauth/form.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oa-core/lib/omniauth/form.rb b/oa-core/lib/omniauth/form.rb index bfab20a..20eebd0 100644 --- a/oa-core/lib/omniauth/form.rb +++ b/oa-core/lib/omniauth/form.rb @@ -90,13 +90,14 @@ module OmniAuth def initialize(options = {}) options[:title] ||= "Authentication Info Required" + options[:header_info] ||= "" self.options = options @html = "" - header(options[:title]) + header(options[:title],options[:header_info]) end - def self.build(title=nil, &block) + def self.build(title=nil,&block) form = OmniAuth::Form.new(title) form.instance_eval(&block) end @@ -138,13 +139,14 @@ module OmniAuth self end - def header(title) + def header(title,header_info) @html << <<-HTML #{title} #{css} + #{header_info}

#{title}

From f94ca9959dd627c10fd7af2c11e27d1b20c5f968 Mon Sep 17 00:00:00 2001 From: Cameron Hurst Date: Sun, 1 May 2011 16:41:44 -0400 Subject: [PATCH 02/31] Added provider for Openid Steam. --- oa-openid/lib/omniauth/openid.rb | 1 + oa-openid/lib/omniauth/strategies/steam.rb | 55 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 oa-openid/lib/omniauth/strategies/steam.rb diff --git a/oa-openid/lib/omniauth/openid.rb b/oa-openid/lib/omniauth/openid.rb index e1d3eec..b16e8c9 100644 --- a/oa-openid/lib/omniauth/openid.rb +++ b/oa-openid/lib/omniauth/openid.rb @@ -55,5 +55,6 @@ module OmniAuth module Strategies autoload :OpenID, 'omniauth/strategies/open_id' autoload :GoogleApps, 'omniauth/strategies/google_apps' + autoload :Steam, 'omniauth/strategies/steam' end end diff --git a/oa-openid/lib/omniauth/strategies/steam.rb b/oa-openid/lib/omniauth/strategies/steam.rb new file mode 100644 index 0000000..4169c93 --- /dev/null +++ b/oa-openid/lib/omniauth/strategies/steam.rb @@ -0,0 +1,55 @@ +require 'omniauth/openid' +module OmniAuth + module Strategies + class Steam < OmniAuth::Strategies::OpenID + def initialize(app, store = nil, api_key = nil, options = {}, &block) + options[:identifier] ||= "http://steamcommunity.com/openid" + options[:name] ||= 'steam' + @api_key = api_key + super(app, store, options, &block) + end + + def user_info(response=nil) + player = user_hash['response']['players']['player'].first + nickname = player["personaname"] + name = player["realname"] + url = player["profileurl"] + country = player["loccountrycode"] + state = player["locstatecode"] + city = player["loccityid"] + + { + 'nickname' => nickname, + 'name' => name, + 'url' => url, + 'location' => "#{city}, #{state}, #{country}" + } + end + + def user_hash + # Steam provides no information back on a openid response other than a 64bit user id + # Need to use this information and make a API call to get user information from steam. + if @api_key + unless @user_hash + uri = URI.parse("http://api.steampowered.com/") + req = Net::HTTP::Get.new("#{uri.path}ISteamUser/GetPlayerSummaries/v0001/?key=#{@api_key}&steamids=#{@openid_response.display_identifier.split("/").last}") + res = Net::HTTP.start(uri.host, uri.port) {|http| + http.request(req) + } + end + @user_hash ||= MultiJson.decode(res.body) + else + {} + end + end + + def auth_hash + OmniAuth::Utils.deep_merge(super, { + 'uid' => @openid_response.display_identifier.split("/").last, + 'user_info' => user_info, + 'extra' => {'user_hash' => user_hash} + }) + end + end + end +end From 77ff4f4083d600fc9dc9fd23acb6151cd9bab701 Mon Sep 17 00:00:00 2001 From: Cameron Hurst Date: Sun, 1 May 2011 16:42:11 -0400 Subject: [PATCH 03/31] Added provider for IGN. --- oa-more/lib/omniauth/more.rb | 1 + oa-more/lib/omniauth/strategies/ign.rb | 59 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 oa-more/lib/omniauth/strategies/ign.rb diff --git a/oa-more/lib/omniauth/more.rb b/oa-more/lib/omniauth/more.rb index 659fa93..7ebb4cb 100644 --- a/oa-more/lib/omniauth/more.rb +++ b/oa-more/lib/omniauth/more.rb @@ -5,5 +5,6 @@ module OmniAuth autoload :WindowsLive, 'omniauth/strategies/windows_live' autoload :Flickr, 'omniauth/strategies/flickr' autoload :Yupoo, 'omniauth/strategies/yupoo' + autoload :Ign, 'omniauth/strategies/ign' end end diff --git a/oa-more/lib/omniauth/strategies/ign.rb b/oa-more/lib/omniauth/strategies/ign.rb new file mode 100644 index 0000000..acefaca --- /dev/null +++ b/oa-more/lib/omniauth/strategies/ign.rb @@ -0,0 +1,59 @@ +require 'omniauth/core' +require 'openssl' + +module OmniAuth + module Strategies + class Ign + include OmniAuth::Strategy + IDENTIFIER_URL_PARAMETER = "" + + class CallbackError < StandardError + attr_accessor :error, :error_reason + def initialize(error, error_reason) + self.error = error + self.error_reason = error_reason + end + end + + def initialize(app, api_key, hostname=nil, options = {}) + options[:name] ||= "ign" + super(app, :ign) + @api_key = api_key + @hostname = hostname + end + + protected + + def request_phase + OmniAuth::Page.build(:title => 'IGN Authentication', :hostname=>@hostname) do + label_field('Identifying you with the IGN server', IDENTIFIER_URL_PARAMETER) + end.to_response + end + + def callback_phase + signature = OpenSSL::HMAC.hexdigest('sha1', @api_key, ("#{request.params["username"]}::#{request.params["timestamp"]}")) + + raise CallbackError.new("Invalid Signature","The supplied and calculated signature did not match, user not approved.") if signature != request.params["signature"] + + super + rescue CallbackError => e + fail!(:invalid_response, e) + end + + def auth_hash + OmniAuth::Utils.deep_merge(super, { + 'uid' => "ign-" + request.params["username"], + 'credentials' => { 'token' => request.params["signature"] }, + 'user_info' => user_info, + 'extra' => { 'user_hash' => request.params } + }) + end + + def user_info + { + 'nickname' => request.params["username"], + } + end + end + end +end \ No newline at end of file From e2c73573b781da07c68447fad2e482fe42c6b9b4 Mon Sep 17 00:00:00 2001 From: Cameron Hurst Date: Sun, 1 May 2011 17:31:08 -0400 Subject: [PATCH 04/31] Fixed handling of no logged in user on IGN. Fixed error from previous hack. --- oa-more/lib/omniauth/strategies/ign.rb | 36 +++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/oa-more/lib/omniauth/strategies/ign.rb b/oa-more/lib/omniauth/strategies/ign.rb index acefaca..27e3675 100644 --- a/oa-more/lib/omniauth/strategies/ign.rb +++ b/oa-more/lib/omniauth/strategies/ign.rb @@ -25,7 +25,7 @@ module OmniAuth protected def request_phase - OmniAuth::Page.build(:title => 'IGN Authentication', :hostname=>@hostname) do + OmniAuth::Form.build(:title => 'IGN Authentication', :header_info=>js) do label_field('Identifying you with the IGN server', IDENTIFIER_URL_PARAMETER) end.to_response end @@ -54,6 +54,40 @@ module OmniAuth 'nickname' => request.params["username"], } end + + def js + @js = <<-JS + $(document).ready(function() { + $.ajax({ + url: "http://#{@hostname}/users/current.json?callback=z33k", + type: "get", + dataType:"jsonp", + success: function(data) { + if(typeof data.error == 'undefined'){ + // There is a current My IGN user + var username = data.my_ign_username; + var signature = data.signature; + var timestamp = data.timestamp; + window.location = "/auth/ign/callback?username=" +username+"&signature="+signature+"×tamp=" + timestamp; + } + else{ + nouser(); + } + } + }); + return false; + }); + function nouser() { + var url = "http://my.ign.com/login?r="+window.location; + top.location = url; + window.location = url; + } + JS + "\n" + + "\n" + + "\n" + end + end end end \ No newline at end of file From 99a316f5b1d85410c932abcd9590d10f2e416754 Mon Sep 17 00:00:00 2001 From: Michael Bleigh Date: Tue, 3 May 2011 17:12:24 -0500 Subject: [PATCH 05/31] Remove #try dependency from recent pull. --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index 992abf3..c505169 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -36,10 +36,12 @@ module OmniAuth # we need these 2 additional requests since vkontakte returns only ids of the City and Country # http://vkontakte.ru/developers.php?o=-17680044&p=getCities - @city ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCities?cids=#{@data['city']}&access_token=#{@access_token.token}"))['response'].try(:[], 0).try(:[], 'name') + cities = MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCities?cids=#{@data['city']}&access_token=#{@access_token.token}"))['response'] + @city ||= cities.first['name'] if cities && cities.first # http://vkontakte.ru/developers.php?o=-17680044&p=getCountries - @country ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCountries?cids=#{@data['country']}&access_token=#{@access_token}"))['response'].try(:[], 0).try(:[], 'name') + countries = MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCountries?cids=#{@data['country']}&access_token=#{@access_token}"))['response'] + @country ||= countries.first['name'] if countries && countries.first end def request_phase From 46353bbb5f544b5d8397adc5e29fe02d65bcf4b3 Mon Sep 17 00:00:00 2001 From: Andrew Willis Date: Wed, 4 May 2011 22:18:48 -0400 Subject: [PATCH 06/31] Use script_name when in test mode --- oa-core/lib/omniauth/strategy.rb | 2 +- oa-core/spec/omniauth/strategy_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/oa-core/lib/omniauth/strategy.rb b/oa-core/lib/omniauth/strategy.rb index e915d72..cce594a 100644 --- a/oa-core/lib/omniauth/strategy.rb +++ b/oa-core/lib/omniauth/strategy.rb @@ -95,7 +95,7 @@ module OmniAuth elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/) @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER'] end - redirect(callback_path) + redirect(script_name + callback_path) end def mock_callback_call diff --git a/oa-core/spec/omniauth/strategy_spec.rb b/oa-core/spec/omniauth/strategy_spec.rb index b18681b..e7c2f49 100644 --- a/oa-core/spec/omniauth/strategy_spec.rb +++ b/oa-core/spec/omniauth/strategy_spec.rb @@ -258,6 +258,11 @@ describe OmniAuth::Strategy do strategy.call(make_env('/AUTH/Test'))[0].should == 302 end + it 'should respect SCRIPT_NAME (a.k.a. BaseURI)' do + response = strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri')) + response[1]['Location'].should == '/sub_uri/auth/test/callback' + end + it 'should be case insensitive on callback path' do strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).should == strategy.call(make_env('/auth/test/callback')) end From 7f9d2f9501ec36e0fb2bbddf663e537d80b3c2aa Mon Sep 17 00:00:00 2001 From: Jamie Wilkinson Date: Thu, 5 May 2011 09:07:07 -0700 Subject: [PATCH 07/31] Rescue timeout errors in OAuth2, e.g. Facebook --- oa-oauth/lib/omniauth/strategies/oauth2.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oa-oauth/lib/omniauth/strategies/oauth2.rb b/oa-oauth/lib/omniauth/strategies/oauth2.rb index 2499421..5f0a64a 100644 --- a/oa-oauth/lib/omniauth/strategies/oauth2.rb +++ b/oa-oauth/lib/omniauth/strategies/oauth2.rb @@ -80,6 +80,8 @@ module OmniAuth fail!(:invalid_credentials, e) rescue ::MultiJson::DecodeError => e fail!(:invalid_response, e) + rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e + fail!(:timeout, e) end def build_access_token From ec45ecf556fb37d8d9858615ffd9bdee4d07f190 Mon Sep 17 00:00:00 2001 From: Anton Litvinenko Date: Thu, 5 May 2011 18:17:27 -0700 Subject: [PATCH 08/31] credentials.merge(...) without exclamation mark doesn't put values into credentials hash instead it returns a new 'merged' hash which is not assigned to anything and 'refresh_token' value never gets added to credentials hash. With exclamation mark value is added directly to credentials hash (and everybody is happy!) --- oa-oauth/lib/omniauth/strategies/oauth2.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/oauth2.rb b/oa-oauth/lib/omniauth/strategies/oauth2.rb index 5f0a64a..c1446b8 100644 --- a/oa-oauth/lib/omniauth/strategies/oauth2.rb +++ b/oa-oauth/lib/omniauth/strategies/oauth2.rb @@ -91,7 +91,7 @@ module OmniAuth def auth_hash credentials = {'token' => @access_token.token} - credentials.merge('refresh_token' => @access_token.refresh_token) if @access_token.expires? + credentials.merge!('refresh_token' => @access_token.refresh_token) if @access_token.expires? OmniAuth::Utils.deep_merge(super, {'credentials' => credentials}) end From 65f58e0f3d25136774b5909a789c28b84e4d54d3 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 6 May 2011 14:27:02 -0400 Subject: [PATCH 09/31] Fixes an issue with a user having exactly one URL - .each was iterating through the hash keys/values and raising an exception. Also supports members with no URLs. --- oa-oauth/lib/omniauth/strategies/linked_in.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/oa-oauth/lib/omniauth/strategies/linked_in.rb b/oa-oauth/lib/omniauth/strategies/linked_in.rb index fded7fd..019c9fd 100644 --- a/oa-oauth/lib/omniauth/strategies/linked_in.rb +++ b/oa-oauth/lib/omniauth/strategies/linked_in.rb @@ -40,10 +40,13 @@ module OmniAuth 'description' => person['headline'], 'public_profile_url' => person['public_profile_url'] } - hash['urls']={} - person['member_url_resources']['member_url'].each do |url| - hash['urls']["#{url['name']}"]=url['url'] - end + hash['urls']={} + member_urls = person['member_url_resources']['member_url'] + if (!member_urls.nil?) and (!member_urls.empty?) + [member_urls].flatten.each do |url| + hash['urls']["#{url['name']}"]=url['url'] + end + end hash['urls']['LinkedIn'] = person['public_profile_url'] hash['name'] = "#{hash['first_name']} #{hash['last_name']}" hash From f016e035be0760cfc72792c6aff43f3b8d4daf14 Mon Sep 17 00:00:00 2001 From: Bobby Marko Date: Fri, 6 May 2011 16:55:04 -0700 Subject: [PATCH 10/31] switched nickname to pull from facebook username instead of the end of the users profile url --- oa-oauth/lib/omniauth/strategies/facebook.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/facebook.rb b/oa-oauth/lib/omniauth/strategies/facebook.rb index d6c701e..ea87e33 100644 --- a/oa-oauth/lib/omniauth/strategies/facebook.rb +++ b/oa-oauth/lib/omniauth/strategies/facebook.rb @@ -45,7 +45,7 @@ module OmniAuth def user_info { - 'nickname' => user_data["link"].split('/').last, + 'nickname' => user_data["username"], 'email' => (user_data["email"] if user_data["email"]), 'first_name' => user_data["first_name"], 'last_name' => user_data["last_name"], From d259340b7cf6f0607d877b33fd8fdd2de61374ee Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Fri, 6 May 2011 18:14:37 -0700 Subject: [PATCH 11/31] Remove dynamic code from gemspec because it can only be built one way --- oa-basic/Gemfile | 6 +++++- oa-basic/oa-basic.gemspec | 1 - oa-core/Gemfile | 2 +- oa-enterprise/Gemfile | 6 +++++- oa-enterprise/oa-enterprise.gemspec | 1 - oa-more/Gemfile | 6 +++++- oa-more/oa-more.gemspec | 1 - oa-oauth/Gemfile | 6 +++++- oa-oauth/oa-oauth.gemspec | 1 - oa-openid/Gemfile | 6 +++++- oa-openid/oa-openid.gemspec | 1 - 11 files changed, 26 insertions(+), 11 deletions(-) diff --git a/oa-basic/Gemfile b/oa-basic/Gemfile index c80ee36..1e01eae 100644 --- a/oa-basic/Gemfile +++ b/oa-basic/Gemfile @@ -1,3 +1,7 @@ -source "http://rubygems.org" +source 'http://rubygems.org' + +platforms :jruby do + gem 'jruby-openssl', '~> 0.7' +end gemspec diff --git a/oa-basic/oa-basic.gemspec b/oa-basic/oa-basic.gemspec index 642cc9c..80e374b 100644 --- a/oa-basic/oa-basic.gemspec +++ b/oa-basic/oa-basic.gemspec @@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING - gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java' gem.add_runtime_dependency 'rest-client', '~> 1.6.0' gem.add_development_dependency 'maruku', '~> 0.6' gem.add_development_dependency 'simplecov', '~> 0.4' diff --git a/oa-core/Gemfile b/oa-core/Gemfile index c80ee36..d65e2a6 100644 --- a/oa-core/Gemfile +++ b/oa-core/Gemfile @@ -1,3 +1,3 @@ -source "http://rubygems.org" +source 'http://rubygems.org' gemspec diff --git a/oa-enterprise/Gemfile b/oa-enterprise/Gemfile index c80ee36..1e01eae 100644 --- a/oa-enterprise/Gemfile +++ b/oa-enterprise/Gemfile @@ -1,3 +1,7 @@ -source "http://rubygems.org" +source 'http://rubygems.org' + +platforms :jruby do + gem 'jruby-openssl', '~> 0.7' +end gemspec diff --git a/oa-enterprise/oa-enterprise.gemspec b/oa-enterprise/oa-enterprise.gemspec index e0946a2..e5727a5 100644 --- a/oa-enterprise/oa-enterprise.gemspec +++ b/oa-enterprise/oa-enterprise.gemspec @@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| gem.add_runtime_dependency 'addressable', '2.2.4' - gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java' gem.add_runtime_dependency 'nokogiri', '~> 1.4.2' gem.add_runtime_dependency 'net-ldap', '~> 0.2.2' gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING diff --git a/oa-more/Gemfile b/oa-more/Gemfile index c80ee36..1e01eae 100644 --- a/oa-more/Gemfile +++ b/oa-more/Gemfile @@ -1,3 +1,7 @@ -source "http://rubygems.org" +source 'http://rubygems.org' + +platforms :jruby do + gem 'jruby-openssl', '~> 0.7' +end gemspec diff --git a/oa-more/oa-more.gemspec b/oa-more/oa-more.gemspec index ffd6b2e..292a405 100644 --- a/oa-more/oa-more.gemspec +++ b/oa-more/oa-more.gemspec @@ -2,7 +2,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| - gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java' gem.add_runtime_dependency 'multi_json', '~> 1.0.0' gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING gem.add_runtime_dependency 'rest-client', '~> 1.6.0' diff --git a/oa-oauth/Gemfile b/oa-oauth/Gemfile index c80ee36..1e01eae 100644 --- a/oa-oauth/Gemfile +++ b/oa-oauth/Gemfile @@ -1,3 +1,7 @@ -source "http://rubygems.org" +source 'http://rubygems.org' + +platforms :jruby do + gem 'jruby-openssl', '~> 0.7' +end gemspec diff --git a/oa-oauth/oa-oauth.gemspec b/oa-oauth/oa-oauth.gemspec index 7608183..e1989c3 100644 --- a/oa-oauth/oa-oauth.gemspec +++ b/oa-oauth/oa-oauth.gemspec @@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| gem.add_runtime_dependency 'faraday', '~> 0.6.1' - gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java' gem.add_runtime_dependency 'multi_json', '~> 1.0.0' gem.add_runtime_dependency 'multi_xml', '~> 0.2.2' gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING diff --git a/oa-openid/Gemfile b/oa-openid/Gemfile index c80ee36..1e01eae 100644 --- a/oa-openid/Gemfile +++ b/oa-openid/Gemfile @@ -1,3 +1,7 @@ -source "http://rubygems.org" +source 'http://rubygems.org' + +platforms :jruby do + gem 'jruby-openssl', '~> 0.7' +end gemspec diff --git a/oa-openid/oa-openid.gemspec b/oa-openid/oa-openid.gemspec index 7033956..8eaba6d 100644 --- a/oa-openid/oa-openid.gemspec +++ b/oa-openid/oa-openid.gemspec @@ -2,7 +2,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| - gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java' gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING gem.add_runtime_dependency 'rack-openid', '~> 1.3.1' gem.add_runtime_dependency 'ruby-openid-apps-discovery', '~> 1.2.0' From fd17bb70242b2edea0b602d3569676c0e7f78ab8 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 7 May 2011 11:54:49 -0700 Subject: [PATCH 12/31] Change Markdown extension to .md --- README.markdown => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.markdown => README.md (100%) diff --git a/README.markdown b/README.md similarity index 100% rename from README.markdown rename to README.md From f835f99265c2f6107c60bf0605c566733aecd5c6 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 7 May 2011 11:55:39 -0700 Subject: [PATCH 13/31] Convert license to Markdown --- LICENSE => LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename LICENSE => LICENSE.md (92%) diff --git a/LICENSE b/LICENSE.md similarity index 92% rename from LICENSE rename to LICENSE.md index 811fa0e..143f9d4 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc. +Copyright (c) 2010-2011 Michael Bleigh, Erik Michaels-Ober, and Intridea, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 202064265b48175c6d4d7836b549e40d73ccad79 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 7 May 2011 11:55:51 -0700 Subject: [PATCH 14/31] Convert all GitHub links to HTTPS --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e686d90..916a4ac 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ OmniAuth currently supports the following external providers: * Mixi (credit: [kiyoshi](https://github.com/kiyoshi)) * Netflix (credit: [caged](https://github.com/caged)) * Qzone (credit: [quake](https://github.com/quake)) - * Rdio (via [brandonweiss](http://github.com/brandonweiss)) + * Rdio (via [brandonweiss](https://github.com/brandonweiss)) * Renren (credit: [quake](https://github.com/quake)) * Salesforce (via [CloudSpokes](http://www.cloudspokes.com)) * SmugMug (credit: [pchilton](https://github.com/pchilton)) @@ -108,12 +108,12 @@ The `user_info` hash will automatically be populated with as much information ab ## Resources -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: +The best place to find more information is the [OmniAuth Wiki](https://github.com/intridea/omniauth/wiki). Some specific information you might be interested in: * [CI Build Status](http://travis-ci.org/#!/intridea/omniauth) -* [Roadmap](http://github.com/intridea/omniauth/wiki/Roadmap) -* [Changelog](http://github.com/intridea/omniauth/wiki/Changelog) -* [Report Issues](http://github.com/intridea/omniauth/issues) +* [Roadmap](https://github.com/intridea/omniauth/wiki/Roadmap) +* [Changelog](https://github.com/intridea/omniauth/wiki/Changelog) +* [Report Issues](https://github.com/intridea/omniauth/issues) * [Mailing List](http://groups.google.com/group/omniauth) ## OmniAuth Core From 15d280ac582c39b867155d13ef0c290f0539f0f8 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 9 May 2011 09:42:20 -0700 Subject: [PATCH 15/31] Test against ruby-head (currently 1.9.3) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 03281a1..640f676 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,3 +5,4 @@ rvm: - 1.9.2 - rbx - ree + - ruby-head From 5a1f4512f9e302d18859fd1412b91782e95f0b4b Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 9 May 2011 11:25:57 -0700 Subject: [PATCH 16/31] Add JRuby back to the CI matrix --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 640f676..dbee033 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ rvm: - 1.8.7 - 1.9.1 - 1.9.2 + - jruby - rbx - ree - ruby-head From 8ab50a26902a5f96aa75da2d27b3140e1769072f Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 9 May 2011 11:52:45 -0700 Subject: [PATCH 17/31] Add jruby-openssl dependency on the java platform --- Gemfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 7caaf9a..3080aad 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,9 @@ source 'http://rubygems.org' +platforms :jruby do + gem 'jruby-openssl', '~> 0.7' +end + gemspec :path => 'oa-basic' gemspec :path => 'oa-core' gemspec :path => 'oa-enterprise' From 34f9986248d260c19e0924bd85cec9b1d3238ba1 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 9 May 2011 21:33:18 -0700 Subject: [PATCH 18/31] Ignore lots of stuff that should be ignored --- .gitignore | 82 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 737b05e..9118f59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,36 +1,56 @@ -## MAC OS -.DS_Store - -/live -.rvmrc - -dist/* - -## TEXTMATE -*.tmproj -tmtags - -## EMACS -*~ -\#* -.\#* - -## VIM -*.swp - -## PROJECT::GENERAL -coverage -rdoc -pkg -tmp -oa-live - -## PROJECT::SPECIFIC +!.autotest +!.document +!.gemtest +!.gitignore +!.rspec +!.yardopts *.gem +*.rbc +*.sw[a-z] +*.tmproj +*.tmproject +*.un~ +*~ +.* +.DS_Store +.Spotlight-V100 +.Trashes +.\#* +._* .bundle -.project +.config +.directory +.elc .loadpath +.project +.redcar +.rvmrc .yardoc -doc - +/.emacs.desktop +/.emacs.desktop.lock +/live +Desktop.ini Gemfile.lock +Icon? +InstalledFiles +Session.vim +Thumbs.db +\#* +\#*\# +_yardoc +auto-save-list +coverage +dist/* +doc +doc/ +lib/bundler/man +oa-live +pkg +pkg/* +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +tmtags +tramp From 7b2f240f752b023d888e65a8e012469448163183 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 9 May 2011 21:33:59 -0700 Subject: [PATCH 19/31] Specify yard from git source --- Gemfile | 4 ++++ Rakefile | 1 - oa-basic/Gemfile | 4 ++++ oa-basic/oa-basic.gemspec | 2 +- oa-core/Gemfile | 4 ++++ oa-core/oa-core.gemspec | 2 +- oa-enterprise/Gemfile | 4 ++++ oa-enterprise/oa-enterprise.gemspec | 2 +- oa-more/Gemfile | 4 ++++ oa-more/oa-more.gemspec | 2 +- oa-oauth/Gemfile | 4 ++++ oa-oauth/oa-oauth.gemspec | 2 +- oa-openid/Gemfile | 4 ++++ oa-openid/oa-openid.gemspec | 2 +- 14 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 3080aad..da5b4cf 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,10 @@ platforms :jruby do gem 'jruby-openssl', '~> 0.7' end +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec :path => 'oa-basic' gemspec :path => 'oa-core' gemspec :path => 'oa-enterprise' diff --git a/Rakefile b/Rakefile index 5323e05..b094175 100644 --- a/Rakefile +++ b/Rakefile @@ -47,4 +47,3 @@ namespace :doc do task.files = PROJECTS.map{|project| "#{root}/#{project}/lib/**/*.rb"} + ['README.markdown', 'LICENSE'] end end - diff --git a/oa-basic/Gemfile b/oa-basic/Gemfile index 1e01eae..af3f2ef 100644 --- a/oa-basic/Gemfile +++ b/oa-basic/Gemfile @@ -4,4 +4,8 @@ platforms :jruby do gem 'jruby-openssl', '~> 0.7' end +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec diff --git a/oa-basic/oa-basic.gemspec b/oa-basic/oa-basic.gemspec index 80e374b..276807f 100644 --- a/oa-basic/oa-basic.gemspec +++ b/oa-basic/oa-basic.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rake', '~> 0.8' gem.add_development_dependency 'rspec', '~> 2.5' gem.add_development_dependency 'webmock', '~> 1.6' - gem.add_development_dependency 'yard', '~> 0.6' + # gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'ZenTest', '~> 4.5' gem.name = 'oa-basic' gem.version = OmniAuth::Version::STRING diff --git a/oa-core/Gemfile b/oa-core/Gemfile index d65e2a6..3c1dac6 100644 --- a/oa-core/Gemfile +++ b/oa-core/Gemfile @@ -1,3 +1,7 @@ source 'http://rubygems.org' +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec diff --git a/oa-core/oa-core.gemspec b/oa-core/oa-core.gemspec index 82f7620..21be5b1 100644 --- a/oa-core/oa-core.gemspec +++ b/oa-core/oa-core.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rack-test', '~> 0.5' gem.add_development_dependency 'rake', '~> 0.8' gem.add_development_dependency 'rspec', '~> 2.5' - gem.add_development_dependency 'yard', '~> 0.6' + # gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'ZenTest', '~> 4.5' gem.name = 'oa-core' gem.version = OmniAuth::Version::STRING diff --git a/oa-enterprise/Gemfile b/oa-enterprise/Gemfile index 1e01eae..af3f2ef 100644 --- a/oa-enterprise/Gemfile +++ b/oa-enterprise/Gemfile @@ -4,4 +4,8 @@ platforms :jruby do gem 'jruby-openssl', '~> 0.7' end +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec diff --git a/oa-enterprise/oa-enterprise.gemspec b/oa-enterprise/oa-enterprise.gemspec index e5727a5..5fefc70 100644 --- a/oa-enterprise/oa-enterprise.gemspec +++ b/oa-enterprise/oa-enterprise.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rake', '~> 0.8' gem.add_development_dependency 'rspec', '~> 2.5' gem.add_development_dependency 'webmock', '~> 1.6' - gem.add_development_dependency 'yard', '~> 0.6' + # gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'ZenTest', '~> 4.5' gem.name = 'oa-enterprise' gem.version = OmniAuth::Version::STRING diff --git a/oa-more/Gemfile b/oa-more/Gemfile index 1e01eae..af3f2ef 100644 --- a/oa-more/Gemfile +++ b/oa-more/Gemfile @@ -4,4 +4,8 @@ platforms :jruby do gem 'jruby-openssl', '~> 0.7' end +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec diff --git a/oa-more/oa-more.gemspec b/oa-more/oa-more.gemspec index 292a405..d617cc9 100644 --- a/oa-more/oa-more.gemspec +++ b/oa-more/oa-more.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rspec', '~> 2.5' gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'webmock', '~> 1.6' - gem.add_development_dependency 'yard', '~> 0.6' + # gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'ZenTest', '~> 4.5' gem.name = 'oa-more' gem.version = OmniAuth::Version::STRING diff --git a/oa-oauth/Gemfile b/oa-oauth/Gemfile index 1e01eae..af3f2ef 100644 --- a/oa-oauth/Gemfile +++ b/oa-oauth/Gemfile @@ -4,4 +4,8 @@ platforms :jruby do gem 'jruby-openssl', '~> 0.7' end +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec diff --git a/oa-oauth/oa-oauth.gemspec b/oa-oauth/oa-oauth.gemspec index e1989c3..0e0f3d8 100644 --- a/oa-oauth/oa-oauth.gemspec +++ b/oa-oauth/oa-oauth.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rspec', '~> 2.5' gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'webmock', '~> 1.6' - gem.add_development_dependency 'yard', '~> 0.6' + # gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'ZenTest', '~> 4.5' gem.name = 'oa-oauth' gem.version = OmniAuth::Version::STRING diff --git a/oa-openid/Gemfile b/oa-openid/Gemfile index 1e01eae..af3f2ef 100644 --- a/oa-openid/Gemfile +++ b/oa-openid/Gemfile @@ -4,4 +4,8 @@ platforms :jruby do gem 'jruby-openssl', '~> 0.7' end +group :development do + gem 'yard', :git => 'https://github.com/lsegal/yard.git' +end + gemspec diff --git a/oa-openid/oa-openid.gemspec b/oa-openid/oa-openid.gemspec index 8eaba6d..3864527 100644 --- a/oa-openid/oa-openid.gemspec +++ b/oa-openid/oa-openid.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rspec', '~> 2.5' gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'webmock', '~> 1.6' - gem.add_development_dependency 'yard', '~> 0.6' + # gem.add_development_dependency 'yard', '~> 0.7' gem.add_development_dependency 'ZenTest', '~> 4.5' gem.name = 'oa-openid' gem.version = OmniAuth::Version::STRING From fe24a0221577b98ea68b7ce2de8d547f909887af Mon Sep 17 00:00:00 2001 From: Timur Vafin Date: Wed, 11 May 2011 20:38:42 +0400 Subject: [PATCH 20/31] Added birthdate field to the user_info hash --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index c505169..cf260c0 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -29,7 +29,7 @@ module OmniAuth def user_data # http://vkontakte.ru/developers.php?o=-17680044&p=Description+of+Fields+of+the+fields+Parameter - @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'city', 'country', 'timezone', 'photo', 'photo_big'] + @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'bday', 'city', 'country', 'timezone', 'photo', 'photo_big'] # http://vkontakte.ru/developers.php?o=-1&p=getProfiles @data ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getProfiles?uid=#{@access_token['user_id']}&fields=#{@fields.join(',')}&access_token=#{@access_token.token}"))['response'][0] @@ -55,6 +55,7 @@ module OmniAuth 'last_name' => @data['last_name'], 'name' => "#{@data['first_name']} #{@data['last_name']}", 'nickname' => @data['nickname'], + 'birthdate' => (@data['bday'].to_date if @data['bday']), 'image' => @data['photo'], 'location' => "#{@country}, #{@city}", 'urls' => { From 9fa45406df582336a9cace2bca8b25f8cd5c2f1e Mon Sep 17 00:00:00 2001 From: Timur Vafin Date: Wed, 11 May 2011 20:53:09 +0400 Subject: [PATCH 21/31] Fixup key name --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index cf260c0..8dc8412 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -29,7 +29,7 @@ module OmniAuth def user_data # http://vkontakte.ru/developers.php?o=-17680044&p=Description+of+Fields+of+the+fields+Parameter - @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'bday', 'city', 'country', 'timezone', 'photo', 'photo_big'] + @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'birthdate', 'city', 'country', 'timezone', 'photo', 'photo_big'] # http://vkontakte.ru/developers.php?o=-1&p=getProfiles @data ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getProfiles?uid=#{@access_token['user_id']}&fields=#{@fields.join(',')}&access_token=#{@access_token.token}"))['response'][0] From 76e70d7bb78d433486724f989ec302316efa6ab9 Mon Sep 17 00:00:00 2001 From: Timur Vafin Date: Wed, 11 May 2011 21:02:22 +0400 Subject: [PATCH 22/31] Fixed key name finaly --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index 8dc8412..e3ba524 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -29,7 +29,7 @@ module OmniAuth def user_data # http://vkontakte.ru/developers.php?o=-17680044&p=Description+of+Fields+of+the+fields+Parameter - @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'birthdate', 'city', 'country', 'timezone', 'photo', 'photo_big'] + @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'bdate', 'city', 'country', 'timezone', 'photo', 'photo_big'] # http://vkontakte.ru/developers.php?o=-1&p=getProfiles @data ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getProfiles?uid=#{@access_token['user_id']}&fields=#{@fields.join(',')}&access_token=#{@access_token.token}"))['response'][0] @@ -55,7 +55,7 @@ module OmniAuth 'last_name' => @data['last_name'], 'name' => "#{@data['first_name']} #{@data['last_name']}", 'nickname' => @data['nickname'], - 'birthdate' => (@data['bday'].to_date if @data['bday']), + 'birth_date' => (@data['bdate'].to_date if @data['bdate']), 'image' => @data['photo'], 'location' => "#{@country}, #{@city}", 'urls' => { From 30ac7a1bced25cff5852320fa5e99aaacb02b8ae Mon Sep 17 00:00:00 2001 From: Timur Vafin Date: Wed, 11 May 2011 12:40:35 -0700 Subject: [PATCH 23/31] @data['bdate'] could contain '09.09' when user hides year. --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index e3ba524..a7ff1d8 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -55,7 +55,7 @@ module OmniAuth 'last_name' => @data['last_name'], 'name' => "#{@data['first_name']} #{@data['last_name']}", 'nickname' => @data['nickname'], - 'birth_date' => (@data['bdate'].to_date if @data['bdate']), + 'birth_date' => (@data['bdate'].to_date rescue nil), 'image' => @data['photo'], 'location' => "#{@country}, #{@city}", 'urls' => { From 491118ad623de338d7b6f67a3dfa849e5442fea2 Mon Sep 17 00:00:00 2001 From: Alexey Medvedev Date: Thu, 12 May 2011 00:44:27 -0700 Subject: [PATCH 24/31] Fix user_info hash parameter 'firstname' to 'first_name' like many other providers have. --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index e3ba524..dbc7c9e 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -51,7 +51,7 @@ module OmniAuth def user_info { - 'firstname' => @data['first_name'], + 'first_name' => @data['first_name'], 'last_name' => @data['last_name'], 'name' => "#{@data['first_name']} #{@data['last_name']}", 'nickname' => @data['nickname'], From 976e65f22161b6dc8c8078f2bce451fb61ad0739 Mon Sep 17 00:00:00 2001 From: Timur Vafin Date: Thu, 12 May 2011 14:18:41 +0400 Subject: [PATCH 25/31] Do not make any date convertion --- oa-oauth/lib/omniauth/strategies/vkontakte.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb index a7ff1d8..b9ea7a8 100644 --- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb +++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb @@ -55,7 +55,7 @@ module OmniAuth 'last_name' => @data['last_name'], 'name' => "#{@data['first_name']} #{@data['last_name']}", 'nickname' => @data['nickname'], - 'birth_date' => (@data['bdate'].to_date rescue nil), + 'birth_date' => @data['bdate'], 'image' => @data['photo'], 'location' => "#{@country}, #{@city}", 'urls' => { From e3ba6383007cead2548c3da1e494aba947d4183c Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Fri, 13 May 2011 00:49:14 +0200 Subject: [PATCH 26/31] Changed parse_user_info method in order to correctly parse user attributes. --- .../cas/service_ticket_validator.rb | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb index 898919d..e7a3fde 100644 --- a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +++ b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb @@ -38,14 +38,29 @@ module OmniAuth # returns nil if given nil def parse_user_info(node) return nil if node.nil? - node.children.inject({}) do |hash, child| - unless child.kind_of?(Nokogiri::XML::Text) || - child.name == 'cas:proxies' || - child.name == 'proxies' - hash[child.name.sub(/^cas:/, '')] = child.content +# node.children.inject({}) do |hash, child| +# unless child.kind_of?(Nokogiri::XML::Text) || +# child.name == 'cas:proxies' || +# child.name == 'proxies' +# hash[child.name.sub(/^cas:/, '')] = child.content +# end +# hash +# end + hash = {} + node.children.each do |e| + unless e.kind_of?(Nokogiri::XML::Text) || + e.name == 'cas:proxies' || + e.name == 'proxies' + # There are no child elements + if e.element_children.count == 0 + hash[e.name] = e.content + elsif e.element_children.count + hash[e.name] = [] if hash[e.name].nil? + hash[e.name].push parse_user_info e + end end - hash end + hash end # finds an `` node in From a15444b7d6cb4e9df6cecfc4e66f52290d36b533 Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Fri, 13 May 2011 00:54:00 +0200 Subject: [PATCH 27/31] Remove commenting --- .../omniauth/strategies/cas/service_ticket_validator.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb index e7a3fde..746267f 100644 --- a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +++ b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb @@ -38,14 +38,6 @@ module OmniAuth # returns nil if given nil def parse_user_info(node) return nil if node.nil? -# node.children.inject({}) do |hash, child| -# unless child.kind_of?(Nokogiri::XML::Text) || -# child.name == 'cas:proxies' || -# child.name == 'proxies' -# hash[child.name.sub(/^cas:/, '')] = child.content -# end -# hash -# end hash = {} node.children.each do |e| unless e.kind_of?(Nokogiri::XML::Text) || From 62f1ad17450533d3d57a038a48cb5ac42676166d Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Fri, 13 May 2011 00:56:43 +0200 Subject: [PATCH 28/31] Added replacement of cas: to nil in order to avoid inconsistencies with namespace resolution. --- .../lib/omniauth/strategies/cas/service_ticket_validator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb index 746267f..7433e0a 100644 --- a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +++ b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb @@ -45,10 +45,10 @@ module OmniAuth e.name == 'proxies' # There are no child elements if e.element_children.count == 0 - hash[e.name] = e.content + hash[e.name.sub(/^cas:/, '')] = e.content elsif e.element_children.count - hash[e.name] = [] if hash[e.name].nil? - hash[e.name].push parse_user_info e + hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil? + hash[e.name.sub(/^cas:/, '')].push parse_user_info e end end end From f4d7dd59f7f661a3b4c26f5b29e5f312bd2202ae Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Thu, 12 May 2011 18:40:28 -0700 Subject: [PATCH 29/31] Update gemspec --- omniauth.gemspec | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/omniauth.gemspec b/omniauth.gemspec index e0e571c..bef88cb 100644 --- a/omniauth.gemspec +++ b/omniauth.gemspec @@ -2,19 +2,19 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| - %w(oa-core oa-oauth oa-basic oa-openid oa-enterprise oa-more).each do |subgem| + %w(oa-basic oa-enterprise oa-core oa-more oa-oauth oa-openid).each do |subgem| gem.add_runtime_dependency subgem, OmniAuth::Version::STRING end - gem.name = 'omniauth' - gem.version = OmniAuth::Version::STRING - gem.summary = %q{Rack middleware for standardized multi-provider authentication.} + gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober'] gem.description = %q{OmniAuth is an authentication framework that that separates the concept of authentiation from the concept of identity, providing simple hooks for any application to have one or multiple authentication providers for a user.} gem.email = ['michael@intridea.com', 'sferik@gmail.com'] - gem.homepage = 'http://github.com/intridea/omniauth' - gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober'] gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)} gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + gem.homepage = 'http://github.com/intridea/omniauth' + gem.name = 'omniauth' gem.require_paths = ['lib'] - gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version= + gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') + gem.summary = %q{Rack middleware for standardized multi-provider authentication.} + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + gem.version = OmniAuth::Version::STRING end From 5628cc97874c60b98234b6ebc320c0dddbf0f9af Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Thu, 12 May 2011 19:18:32 -0700 Subject: [PATCH 30/31] Update addressable dependency to version 2.2.6 --- oa-enterprise/oa-enterprise.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oa-enterprise/oa-enterprise.gemspec b/oa-enterprise/oa-enterprise.gemspec index 5fefc70..a0fcc01 100644 --- a/oa-enterprise/oa-enterprise.gemspec +++ b/oa-enterprise/oa-enterprise.gemspec @@ -2,7 +2,7 @@ require File.expand_path('../lib/omniauth/version', __FILE__) Gem::Specification.new do |gem| - gem.add_runtime_dependency 'addressable', '2.2.4' + gem.add_runtime_dependency 'addressable', '~> 2.2.6' gem.add_runtime_dependency 'nokogiri', '~> 1.4.2' gem.add_runtime_dependency 'net-ldap', '~> 0.2.2' gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING From f217073de3e24198ec30402be555feb018ee648d Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 14 May 2011 10:11:04 -0700 Subject: [PATCH 31/31] Rakefiles are executables --- README.md | 1 - Rakefile | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 916a4ac..9aeaf46 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ To install OmniAuth, simply install the gem: gem install omniauth - ## Continuous Integration [![Build Status](http://travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth) diff --git a/Rakefile b/Rakefile index b094175..6a538e9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +#!/usr/bin/env rake + $:.unshift File.expand_path('..', __FILE__) require 'tasks/all'