Module: Rack::Webauth::WardenStrategy::ClassMethods

Defined in:
lib/rack-webauth/warden_strategy.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object


59
60
61
62
63
# File 'lib/rack-webauth/warden_strategy.rb', line 59

def self.extended(base)
  class << base
    attr_writer :finder
  end
end

Instance Method Details

#finderObject

Default user finder. By default initializes a Rack::Webauth::User. You can set it to something else:

Rack::Webauth::WardenStrategy.finder = lambda {
  MyUserModel.find_by_email_address(webauth.attributes['mail'])
}

The finder will be evaluated inside the strategy instance, so you have access to “webauth”, “env”, …


75
76
77
78
79
# File 'lib/rack-webauth/warden_strategy.rb', line 75

def finder
  @finder ||= lambda {
    Rack::Webauth::User.new(webauth)
  }
end