Module: OpenID

Defined in:
lib/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 Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cacheObject

Returns the value of attribute cache.



53
54
55
# File 'lib/gapps_openid.rb', line 53

def cache
  @cache
end

.loggerObject

Returns the value of attribute logger.



53
54
55
# File 'lib/gapps_openid.rb', line 53

def logger
  @logger
end

Class Method Details

.default_discoverObject



52
# File 'lib/gapps_openid.rb', line 52

alias_method :default_discover, :discover

.discover(uri) ⇒ Object



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

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