Sha256: 419832b5758c9a9bdf23b9eb192eda17f4d6a6e9d92638c57f804f74076a675f

Contents?: true

Size: 710 Bytes

Versions: 8

Compression:

Stored size: 710 Bytes

Contents

require 'openid/consumer'
require 'gapps_openid'

module OpenID
  # Because gapps_openid changes the discovery order
  # (looking first for Google Apps, then anything else),
  # we need to monkeypatch it to make it play nicely
  # with others.
  def self.discover(uri)
    discovered = self.default_discover(uri)

    if discovered.last.empty?
      info = discover_google_apps(uri)
      return info if info
    end

    return discovered
  rescue OpenID::DiscoveryFailure => e
    info = discover_google_apps(uri)

    if info.nil?
      raise e
    else
      return info
    end
  end

  def self.discover_google_apps(uri)
    discovery = GoogleDiscovery.new
    discovery.perform_discovery(uri)
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
omniauth-google-apps-0.0.1 lib/openid/gapps.rb
oa-openid-0.3.2 lib/omniauth/openid/gapps.rb
oa-openid-0.3.0 lib/omniauth/openid/gapps.rb
oa-openid-0.3.0.rc3 lib/omniauth/openid/gapps.rb
omniauth-0.2.6 oa-openid/lib/omniauth/openid/gapps.rb
oa-openid-0.2.6 lib/omniauth/openid/gapps.rb
omniauth-0.2.5 oa-openid/lib/omniauth/openid/gapps.rb
oa-openid-0.2.5 lib/omniauth/openid/gapps.rb