From 490e233fb11ba8be4544c92b418df252b41ffd35 Mon Sep 17 00:00:00 2001 From: Michael Bleigh Date: Mon, 19 Jul 2010 10:07:21 -0500 Subject: [PATCH] Adds support for Google Apps for the domain. --- oa-openid/Gemfile | 2 +- oa-openid/lib/omniauth/openid.rb | 2 +- oa-openid/lib/omniauth/strategies/google.rb | 9 --------- .../lib/omniauth/strategies/google_apps.rb | 17 +++++++++++++++++ oa-openid/lib/omniauth/strategies/open_id.rb | 1 + oa-openid/oa-openid.gemspec | 3 ++- 6 files changed, 22 insertions(+), 12 deletions(-) delete mode 100644 oa-openid/lib/omniauth/strategies/google.rb create mode 100644 oa-openid/lib/omniauth/strategies/google_apps.rb diff --git a/oa-openid/Gemfile b/oa-openid/Gemfile index 9e3ee5d5c..3740c3261 100644 --- a/oa-openid/Gemfile +++ b/oa-openid/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" gem 'oa-core', :path => File.expand_path('../../oa-core/', __FILE__) - +gem 'ruby-openid-apps-discovery' # Will automatically pull in this gem and all its # dependencies specified in the gemspec gem 'oa-openid', :path => File.expand_path("..", __FILE__) diff --git a/oa-openid/lib/omniauth/openid.rb b/oa-openid/lib/omniauth/openid.rb index 0dde24c06..5a40f8c05 100644 --- a/oa-openid/lib/omniauth/openid.rb +++ b/oa-openid/lib/omniauth/openid.rb @@ -3,6 +3,6 @@ module OmniAuth module Strategies autoload :OpenID, 'omniauth/strategies/open_id' - autoload :Google, 'omniauth/strategies/google' + autoload :GoogleApps, 'omniauth/strategies/google_apps' end end diff --git a/oa-openid/lib/omniauth/strategies/google.rb b/oa-openid/lib/omniauth/strategies/google.rb deleted file mode 100644 index d2f815af6..000000000 --- a/oa-openid/lib/omniauth/strategies/google.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'omniauth/openid' - -module OmniAuth - module Strategies - class Google < OmniAuth::Strategies::OpenID - def identifier; 'https://www.google.com/accounts/o8/id' end - end - end -end diff --git a/oa-openid/lib/omniauth/strategies/google_apps.rb b/oa-openid/lib/omniauth/strategies/google_apps.rb new file mode 100644 index 000000000..40181dadf --- /dev/null +++ b/oa-openid/lib/omniauth/strategies/google_apps.rb @@ -0,0 +1,17 @@ +require 'omniauth/openid' + +module OmniAuth + module Strategies + class GoogleApps < OmniAuth::Strategies::OpenID + def initialize(app, domain, store = nil, options = {}) + @domain = domain + options[:name] ||= 'apps' + super(app, store, options) + end + + def identifier + @domain + end + end + end +end diff --git a/oa-openid/lib/omniauth/strategies/open_id.rb b/oa-openid/lib/omniauth/strategies/open_id.rb index dbe138b99..71901913c 100644 --- a/oa-openid/lib/omniauth/strategies/open_id.rb +++ b/oa-openid/lib/omniauth/strategies/open_id.rb @@ -1,4 +1,5 @@ require 'rack/openid' +require 'gapps_openid' require 'omniauth/openid' module OmniAuth diff --git a/oa-openid/oa-openid.gemspec b/oa-openid/oa-openid.gemspec index f04014ecf..bb24b8a5b 100644 --- a/oa-openid/oa-openid.gemspec +++ b/oa-openid/oa-openid.gemspec @@ -11,8 +11,9 @@ Gem::Specification.new do |gem| gem.files = Dir.glob("{lib}/**/*") + %w(README.rdoc LICENSE.rdoc CHANGELOG.rdoc) - gem.add_dependency 'oa-core', version + gem.add_dependency 'oa-core', version gem.add_dependency 'rack-openid', '~> 1.0.3' + gem.add_dependency 'ruby-openid-apps-discovery' eval File.read(File.join(File.dirname(__FILE__), '../development_dependencies.rb')) end