mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-23 20:11:49 +00:00
Expose digest auth checking functions
PUBLISHED_FROM=1bfc6e332f56b68eb6155bb729a97a0d8d5a316c
This commit is contained in:
1 parent
cf8d0a25aa
commit
9ab6d084df
5 files changed
+54
-10
No files matched your search
+17
@@ -4541,6 +4541,23 @@ extern void mg_hash_md5_v(size_t num_msgs, const uint8_t *msgs[],
|
||||
extern void mg_hash_sha1_v(size_t num_msgs, const uint8_t *msgs[],
|
||||
const size_t *msg_lens, uint8_t *digest);
|
||||
|
||||
/*
|
||||
* Checks whether an http request is authorized. `domain` is the authentication
|
||||
* realm, `passwords_file` is a htdigest file (can be created e.g. with
|
||||
* `htdigest` utility). If either `domain` or `passwords_file` is NULL, this
|
||||
* function always returns 1; otherwise checks the authentication in the
|
||||
* http request and returns 1 only if there is a match; 0 otherwise.
|
||||
*/
|
||||
int mg_http_is_authorized(struct http_message *hm, struct mg_str path,
|
||||
int is_directory, const char *domain,
|
||||
const char *passwords_file, int is_global_pass_file);
|
||||
|
||||
/*
|
||||
* Sends 401 Unauthorized response.
|
||||
*/
|
||||
void mg_http_send_digest_auth_request(struct mg_connection *c,
|
||||
const char *domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Reference in new issue
Block a user