Module: OpenID

Defined in:
lib/warden-googleapps/gapps_openid.rb

Overview

Extends ruby-openid to support the discovery protocol used by Google Apps. Usage is generally simple. Where using ruby-openid’s Consumer, add the line

require 'gapps_openid'

Caching of discovery information is enabled when used with rails. In other environments, a cache can be set via:

OpenID::GoogleDiscovery.cache = ...

The cache must implement methods read(key) and write(key,value)

In some cases additional setup is required, particularly to set the location of trusted root certificates for validating XRDS signatures. If standard locations don’t work, additional files and directories can be added via:

OpenID::SimpleSign.store.add_file(path_to_cacert_pem)

or

OpenID::SimpleSign.store.add_path(path_to_ca_dir)

TODO:

  • Memcache support for caching host-meta and site XRDS docs

  • Better packaging (gem/rails)

Defined Under Namespace

Classes: GoogleDiscovery, SimpleSign

Class Method Summary collapse

Class Method Details

.default_discoverObject



52
# File 'lib/warden-googleapps/gapps_openid.rb', line 52

alias_method :default_discover, :discover

.discover(uri) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/warden-googleapps/gapps_openid.rb', line 55

def self.discover(uri)
  # Set the CA file for the fetcher so the HTTPS requests will not issue warnings.
  fetcher.ca_file = File.join(File.dirname(__FILE__), 'ca-bundle.crt')
  discovery = GoogleDiscovery.new
  info = discovery.perform_discovery(uri)
  if not info.nil?
    return info
  end
  return self.default_discover(uri)
end