Class: OpenIdAuthentication::Middleware
- Inherits:
-
Object
- Object
- OpenIdAuthentication::Middleware
- Defined in:
- lib/open_id_authentication/middleware.rb
Class Method Summary collapse
-
.new(app) ⇒ Object
middleware creation.
- .store ⇒ Object
- .store=(*store_option) ⇒ Object
Class Method Details
.new(app) ⇒ Object
middleware creation
8 9 10 11 12 13 14 |
# File 'lib/open_id_authentication/middleware.rb', line 8 def self.new(app) if store.nil? Rails.logger.warn "OpenIdAuthentication.store is nil. Using in-memory store." end ::Rack::OpenID.new(app, store) end |
.store ⇒ Object
16 17 18 |
# File 'lib/open_id_authentication/middleware.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/open_id_authentication/middleware.rb', line 20 def self.store=(*store_option) store, *args = *([ 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(args)) else store end end |