Class: Capsium::Reactor::Htpasswd
- Inherits:
-
Object
- Object
- Capsium::Reactor::Htpasswd
- Defined in:
- lib/capsium/reactor/htpasswd.rb,
sig/capsium/reactor/htpasswd.rbs
Overview
Apache htpasswd verification (05x-authentication). Supported hash formats: bcrypt ($2a$/$2b$/$2y$), Apache apr1 MD5 and md5-crypt ($apr1$/$1$), unsalted SHA-1 (SHA), and a crypt(3) fallback for the rest (platform-dependent).
Defined Under Namespace
Modules: Md5Crypt
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Htpasswd
constructor
A new instance of Htpasswd.
- #usernames ⇒ Array[String]
- #verify?(username, password) ⇒ Boolean
Constructor Details
Instance Attribute Details
#path ⇒ String (readonly)
Returns the value of attribute path.
89 90 91 |
# File 'lib/capsium/reactor/htpasswd.rb', line 89 def path @path end |
Instance Method Details
#usernames ⇒ Array[String]
98 99 100 |
# File 'lib/capsium/reactor/htpasswd.rb', line 98 def usernames @entries.keys end |
#verify?(username, password) ⇒ Boolean
102 103 104 105 106 107 |
# File 'lib/capsium/reactor/htpasswd.rb', line 102 def verify?(username, password) hash = @entries[username] return false unless hash verify_hash(hash, password) end |