class Tilia::Dav::Auth::Backend::Sequel

This is an authentication backend that uses a database to manage passwords.

Attributes

table_name[RW]

PDO table name we'll be using

@var string

Public Class Methods

new(sequel) click to toggle source

Creates the backend object.

If the filename argument is passed in, it will parse out the specified file fist.

@param sequel

# File lib/tilia/dav/auth/backend/sequel.rb, line 17
def initialize(sequel)
  @sequel = sequel
  @table_name = 'users'

  super()
end

Public Instance Methods

digest_hash(_realm, username) click to toggle source

Returns the digest hash for a user.

@param string realm @param string username @return string|null

# File lib/tilia/dav/auth/backend/sequel.rb, line 29
def digest_hash(_realm, username)
  @sequel.fetch("SELECT digesta1 FROM #{@table_name} WHERE username=?", username) do |row|
    return row[:digesta1]
  end
  nil
end