Module: OpenIdAuthentication::Middleware

Defined in:
lib/open_id_authentication/middleware.rb

Class Method Summary collapse

Class Method Details

.new(app) ⇒ Object

middleware creation



12
13
14
15
16
17
18
# File 'lib/open_id_authentication/middleware.rb', line 12

def new(app)
  if store.nil?
    OpenID::Util.logger.warn("OpenIdAuthentication.store is nil. Using in-memory store.")
  end

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

.storeObject



20
21
22
# File 'lib/open_id_authentication/middleware.rb', line 20

def store
  @@store
end

.store=(*store_option) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/open_id_authentication/middleware.rb', line 24

def store=(*store_option)
  storage, *args = *[store_option].flatten

  @@store = case storage
  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 "dalli"
    require "openid/store/memcache"
    OpenID::Store::Memcache.new(Dalli::Client.new(args))
  else
    storage
  end
end