Skip to content
Browse files

Raise an error if the domain is not handled by google

  • Loading branch information...
1 parent 50ca008 commit a691574d2484bc1f401ae7ed66dbedad17f4f685 @ConradIrwin ConradIrwin committed Oct 5, 2011
Showing with 11 additions and 6 deletions.
  1. +11 −6 lib/gapps_openid.rb
View
17 lib/gapps_openid.rb
@@ -58,19 +58,24 @@ class << self
end
def self.discover(uri)
+ if uri.start_with? "https://www.google.com/accounts"
+ return default_discover(uri)
+ end
+
discovery = GoogleDiscovery.new
info = discovery.perform_discovery(uri)
- if not info.nil?
- OpenID.logger.debug("Discovery info = #{info}") unless OpenID.logger.nil?
- return info
- end
- return self.default_discover(uri)
+
+ raise OpenID::GoogleDiscovery::NotGoogle if info.nil?
+ OpenID.logger.debug("Discovery info = #{info}") unless OpenID.logger.nil?
+ return info
end
# Handles the bulk of Google's modified discovery prototcol
# See http://groups.google.com/group/google-federated-login-api/web/openid-discovery-for-hosted-domains
class GoogleDiscovery
-
+
+ class NotGoogle < OpenID::OpenIDError; end
+
OpenID.cache = RAILS_CACHE rescue nil
OpenID.logger = RAILS_DEFAULT_LOGGER rescue nil

0 comments on commit a691574

Please sign in to comment.
Something went wrong with that request. Please try again.