hashed key store.
More...
#include <http_auth_backend.h>
hashed key store.
- each line contains username and auth-data, separated by colon
- auth-data should be based on PHC
PHC : $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
id | name | supported |
1 | md5_crypt | never |
2 | bcrypt | never |
2a | bcrypt | no |
2b | bcrypt | no |
5 | sha256_crypt | yes |
6 | sha512_crypt | yes |
pbkdf2-sha256 | pkbdf2_sha256 | no |
pbkdf2-sha512 | pkbdf2_sha512 | no |
scrypt | scrypt | no |
argon2 | argon2 | no |
bcrypt | bcrypt | no |
- See also
- https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md
◆ cache_type
◆ const_iterator
◆ iterator
◆ key_type
◆ value_type
◆ authenticate()
std::error_code HttpAuthBackendHtpasswd::authenticate |
( |
const key_type & |
username, |
|
|
const value_type & |
authdata |
|
) |
| |
|
overridevirtual |
validate user and authdata against backend.
- Returns
- error
- Return values
-
false | no authentication error |
Implements HttpAuthBackend.
◆ begin() [1/2]
◆ begin() [2/2]
iterator HttpAuthBackendHtpasswd::begin |
( |
| ) |
|
|
inlinenoexcept |
◆ end() [1/2]
◆ end() [2/2]
iterator HttpAuthBackendHtpasswd::end |
( |
| ) |
|
|
inlinenoexcept |
◆ erase()
size_t HttpAuthBackendHtpasswd::erase |
( |
const key_type & |
username | ) |
|
|
inline |
remove username from credential cache.
◆ find() [1/2]
◆ find() [2/2]
◆ from_file()
std::error_code HttpAuthBackendHtpasswd::from_file |
( |
const std::string & |
filename | ) |
|
replace cache with content from file.
◆ from_stream()
std::error_code HttpAuthBackendHtpasswd::from_stream |
( |
std::istream & |
is | ) |
|
replace cache with content of input-stream.
- Returns
- error-code
- Return values
-
false | when no error happened |
◆ from_stream_()
std::error_code HttpAuthBackendHtpasswd::from_stream_ |
( |
std::istream & |
is | ) |
|
|
private |
◆ hash_password()
std::string HttpAuthBackendHtpasswd::hash_password |
( |
const std::string & |
password | ) |
|
|
staticprivate |
Calculate hash of plain-text password.
The hash generated by this function should be used at http basic authentication to speed up verification of the transferred credentials against account information stored in passwd
file. There are no direct requirement how the hash should be calculated. Currently it uses following formula: HASH=SHA256(SHA256(plain-text-password)).
◆ set()
void HttpAuthBackendHtpasswd::set |
( |
const key_type & |
username, |
|
|
const value_type & |
authdata |
|
) |
| |
|
inline |
set username and password in cache.
if username exists in cache, overwrite entry with password, otherwise create new entry for username
◆ to_stream()
void HttpAuthBackendHtpasswd::to_stream |
( |
std::ostream & |
os | ) |
|
write cache content to output-stream.
◆ credentials_
◆ credentials_cache_
◆ file_meta_
◆ filename_
std::string HttpAuthBackendHtpasswd::filename_ |
|
private |
◆ is_file_
bool HttpAuthBackendHtpasswd::is_file_ {false} |
|
private |
The documentation for this class was generated from the following files: