class RIMS::Password::Source

expected behavior of a typical password source.

1. a password source plug-in file is loaded by a
   configuration file item of <tt>load_libraries</tt>.
   (exceptions: RIMS::Password::PlainSource and
   RIMS::Password::HashSource are not need to load.)
2. RIMS::Authentication.add_plug_in is called to enable a
   password source on loading its plug-in file.
3. a password source object is built from a configuration
   file by its <tt>build_from_conf</tt> class method.
4. if any password source's <tt>raw_passwrd?</tt> method
   returns a <tt>false</tt> value, RIMS IMAP server disables
   challenge-response authentication options (ex. CRAM-MD5).
5. a logger object is set to a <tt>logger</tt> write
   attribute on a password source object. and the password
   source's <tt>start</tt> method is called.
6. a password source object authenticates a user by its
   authentication methods those are <tt>fetch_password</tt>
   or <tt>compare_password</tt>.
7. to deliver a message to a user, a password source object
   confirms existence of a user by its <tt>user?</tt>
   method.
8. a <tt>stop</tt> method of a password source object is
   called at stopping server.

Attributes

logger[W]

Public Class Methods

build_from_conf(config) click to toggle source
# File lib/rims/passwd.rb, line 75
def self.build_from_conf(config)
  raise NotImplementedError, 'not implemented.'
end

Public Instance Methods

compare_password(username, password) click to toggle source

if a user exists and the user's password is right, this method should return a true context value (not false, nil). if a user exists and the user's password is wrong, this method should return a false context value (false< or nil). if a user does not exist, this method should return a false context value (false< or nil).

# File lib/rims/passwd.rb, line 69
def compare_password(username, password)
  if (raw_password = fetch_password(username)) then
    password == raw_password
  end
end
fetch_password(username) click to toggle source

if a user exists, this method should return the user's plain text password. if a user does not exist, this method should return a nil value.

# File lib/rims/passwd.rb, line 57
def fetch_password(username)
  nil
end
raw_password?() click to toggle source

this method declares that this password source returns a plain text password or do not it. if this method will return a true value, fetch_password may be called. if this method will return a false value, fetch_password will never be called.

# File lib/rims/passwd.rb, line 45
def raw_password?
  false
end
start() click to toggle source
# File lib/rims/passwd.rb, line 33
def start
end
stop() click to toggle source
# File lib/rims/passwd.rb, line 36
def stop
end
user?(username) click to toggle source
# File lib/rims/passwd.rb, line 49
def user?(username)
  raise NotImplementedError, 'not implemented.'
end