Module: WEBrick::HTTPAuth::UserDB

Included in:
Htdigest, Htpasswd
Defined in:
lib/webrick/httpauth/userdb.rb

Overview

User database mixin for HTTPAuth. This mixin dispatches user record access to the underlying auth_type for this database.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_typeObject

The authentication type.

WEBrick::HTTPAuth::BasicAuth or WEBrick::HTTPAuth::DigestAuth are built-in.



25
26
27
# File 'lib/webrick/httpauth/userdb.rb', line 25

def auth_type
  @auth_type
end

Instance Method Details

#get_passwd(realm, user, reload_db = false) ⇒ Object

Retrieves a password in realm for user for the auth_type of this database. reload_db is a dummy value.



47
48
49
# File 'lib/webrick/httpauth/userdb.rb', line 47

def get_passwd(realm, user, reload_db=false)
  make_passwd(realm, user, self[user])
end

#make_passwd(realm, user, pass) ⇒ Object

Creates an obscured password in realm with user and password using the auth_type of this database.



31
32
33
# File 'lib/webrick/httpauth/userdb.rb', line 31

def make_passwd(realm, user, pass)
  @auth_type::make_passwd(realm, user, pass)
end

#set_passwd(realm, user, pass) ⇒ Object

Sets a password in realm with user and password for the auth_type of this database.



39
40
41
# File 'lib/webrick/httpauth/userdb.rb', line 39

def set_passwd(realm, user, pass)
  self[user] = pass
end