Module: OpenID

Defined in:
lib/openid/gapps.rb

Class Method Summary collapse

Class Method Details

.discover(uri) ⇒ Object

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.

Raises:

  • (OpenID::DiscoveryFailure)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/openid/gapps.rb', line 9

def self.discover(uri)
  raise OpenID::DiscoveryFailure.new("No URL Provided", 422) if uri.nil?

  begin
    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
end

.discover_google_apps(uri) ⇒ Object



32
33
34
35
# File 'lib/openid/gapps.rb', line 32

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