Module: OpenIdAuthentication

Defined in:
lib/open_id_authentication.rb,
lib/open_id_authentication/version.rb

Defined Under Namespace

Modules: ControllerMethods Classes: Railtie, Result

Constant Summary collapse

VERSION =
"1.1.0"

Class Method Summary collapse

Class Method Details

.new(app) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/open_id_authentication.rb', line 6

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



15
16
17
# File 'lib/open_id_authentication.rb', line 15

def self.store
  @@store
end

.store=(*store_option) ⇒ Object



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

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