Sha256: 65f77cb50ab1d08c91e1e0e7629ce01e0ac03b3be0f36516a90a457115e618d8

Contents?: true

Size: 724 Bytes

Versions: 13

Compression:

Stored size: 724 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

13 entries across 13 versions & 1 rubygems

Version Path
oa-openid-0.2.4 lib/omniauth/openid/gapps.rb
oa-openid-0.2.3 lib/omniauth/openid/gapps.rb
oa-openid-0.2.2 lib/omniauth/openid/gapps.rb
oa-openid-0.2.1 lib/omniauth/openid/gapps.rb
oa-openid-0.2.0 lib/omniauth/openid/gapps.rb
oa-openid-0.2.0.beta5 lib/omniauth/openid/gapps.rb
oa-openid-0.2.0.beta4 lib/omniauth/openid/gapps.rb
oa-openid-0.2.0.beta3 lib/omniauth/openid/gapps.rb
oa-openid-0.2.0.beta2 lib/omniauth/openid/gapps.rb
oa-openid-0.2.0.beta1 lib/omniauth/openid/gapps.rb
oa-openid-0.1.6 lib/omniauth/openid/gapps.rb
oa-openid-0.1.5 lib/omniauth/openid/gapps.rb
oa-openid-0.1.4 lib/omniauth/openid/gapps.rb