Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Raise an error if the domain is not handled by google
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradIrwin committed Oct 6, 2011
1 parent 50ca008 commit a691574
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/gapps_openid.rb
Expand Up @@ -58,19 +58,24 @@ class << self
end end


def self.discover(uri) def self.discover(uri)
if uri.start_with? "https://www.google.com/accounts"
return default_discover(uri)
end

discovery = GoogleDiscovery.new discovery = GoogleDiscovery.new
info = discovery.perform_discovery(uri) info = discovery.perform_discovery(uri)
if not info.nil?
OpenID.logger.debug("Discovery info = #{info}") unless OpenID.logger.nil? raise OpenID::GoogleDiscovery::NotGoogle if info.nil?
return info OpenID.logger.debug("Discovery info = #{info}") unless OpenID.logger.nil?
end return info
return self.default_discover(uri)
end end


# Handles the bulk of Google's modified discovery prototcol # 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 # See http://groups.google.com/group/google-federated-login-api/web/openid-discovery-for-hosted-domains
class GoogleDiscovery class GoogleDiscovery


class NotGoogle < OpenID::OpenIDError; end

OpenID.cache = RAILS_CACHE rescue nil OpenID.cache = RAILS_CACHE rescue nil
OpenID.logger = RAILS_DEFAULT_LOGGER rescue nil OpenID.logger = RAILS_DEFAULT_LOGGER rescue nil


Expand Down

0 comments on commit a691574

Please sign in to comment.