Module: OpenIdAuthentication

Defined in:
lib/passport/openid/protocol.rb

Defined Under Namespace

Classes: Result

Class Method Summary collapse

Class Method Details

.new(app) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/passport/openid/protocol.rb', line 7

def self.new(app)
  store = OpenIdAuthentication.store
  if store.nil?
    Rails.logger.warn "OpenIdAuthentication.store is nil. Using in-memory store."
  end

  ::Rack::OpenID.new(app, OpenIdAuthentication.store)
end

.storeObject



16
17
18
# File 'lib/passport/openid/protocol.rb', line 16

def self.store
  @@store
end

.store=(*store_option) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/passport/openid/protocol.rb', line 20

def self.store=(*store_option)
  store, *parameters = *([ store_option ].flatten)

  @@store = case store
  when :memory
    require 'openid/store/memory'
    OpenID::Store::Memory.new
  when :file
    require 'openid/store/filesystem'
    OpenID::Store::Filesystem.new(Rails.root.join('tmp/openids'))
  when :memcache
    require 'memcache'
    require 'openid/store/memcache'
    OpenID::Store::Memcache.new(MemCache.new(parameters))
  else
    store
  end
end