class HTAuth::ENTRY_KLASS
Object version of a single record from an htdigest file
Object version of a single entry from a htpasswd file
Attributes
the algorithm used to create the digest of this entry
the algorithm arguments used to create the digest of this entry
the password digest of this entry
the user of this entry
Public Class Methods
Create an instance of this class from a line of text
- line
-
a line of text from a htpasswd file
Returns¶ ↑
Returns an instance of PasswdEntry
test if the given line is valid for this Entry
class
A valid entry is a single line composed of two parts; a username and a password separated by a ':' character. Neither the username nor the password may contain a ':' character
- line
-
a line of text from a file
Returns¶ ↑
Returns the individual parts of the line
Raises InvalidPasswdEntry
if it is not an valid entry
Create a new Entry
with the given user, password, and algorithm
Public Instance Methods
Check if the given password is the password of this entry check the password and make sure it works, in the case that the algorithm is unknown it tries all of the ones that it thinks it could be, and marks the algorithm if it matches when looking for a matche, we always compare all of them, no short circuiting
calculate the new digest of the given password
Update the password of the entry with its new value
If we have an array of algorithms, then we set it to CRYPT
Private Instance Methods
set the algorithm for the entry
# File lib/htauth/passwd_entry.rb, line 71 def algorithm=(alg) return @algorithm if Algorithm::EXISTING == alg case alg when String @algorithm = Algorithm.algorithm_from_name(alg) when ::HTAuth::Algorithm @algorithm = alg else raise InvalidAlgorithmError, "Unable to assign #{alg} to algorithm" end return @algorithm end
set fields on the algorithm
# File lib/htauth/passwd_entry.rb, line 85 def algorithm_args=(args) args.each do |key, value| method = "#{key}=" @algorithm.send(method, value) if @algorithm.respond_to?(method) end end