module OpenID

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.cache = ...

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

Similarly, logging will attempt to use the default Rail's logger, but can be overriden by calling

OpenID.logger = ...

The logger must respond to warn, debug, and info methods

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:

Attributes

cache[RW]
logger[RW]

Public Class Methods

default_discover(uri)
Alias for: discover
discover(uri) click to toggle source
# File lib/gapps_openid.rb, line 63
def self.discover(uri)
  discovery = GoogleDiscovery.new
  info = discovery.perform_discovery(uri)
  if not info.nil?
    OpenID.logger.debug("Discovery info = #{info}") unless OpenID.logger.nil?
    return info
  end
  return self.default_discover(uri)
end
Also aliased as: default_discover