Class: Htpasswd::Acls::Htdigest

Inherits:
CompositeBase show all
Defined in:
lib/htpasswd/acls/htdigest.rb

Instance Method Summary collapse

Methods inherited from CompositeBase

#authorized?, #initialize

Methods inherited from Base

[], #authorize_pass, #authorize_type, #authorize_user, #authorized?, #initialize, #pass, register, #type, #user

Constructor Details

This class inherits a constructor from Htpasswd::Acls::CompositeBase

Instance Method Details

#initialize_composite(options) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/htpasswd/acls/htdigest.rb', line 4

def initialize_composite(options)
  IO.foreach(options[:file]) do |line|
    user, realm, pass = line.chomp.split(':', 3)
    self << Acls::Digest.new(:user=>user, :realm=>realm, :pass=>pass)
  end
rescue => err
  logger.debug("%s: [%s]%s" % [self.class, err.class, err])
  raise ConfigurationError, "Cannot read password file. '#{options[:file]}'"
end