mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 10:46:23 +00:00
Improve HTTP authorization diagnostics
This commit is contained in:
parent
4987c0d689
commit
33a17a01fe
5
httpd.c
5
httpd.c
@ -391,6 +391,11 @@ int authorize_restful(struct http_request *r)
|
||||
return 200;
|
||||
}
|
||||
if (!is_authorized_restful(&r->request_header.authorization)) {
|
||||
DEBUGF(httpd, "Authorization failed: scheme=%d user=%s password=%s",
|
||||
r->request_header.authorization.scheme,
|
||||
alloca_str_toprint(r->request_header.authorization.scheme == BASIC ? r->request_header.authorization.credentials.basic.user : NULL),
|
||||
alloca_str_toprint(r->request_header.authorization.scheme == BASIC ? r->request_header.authorization.credentials.basic.password : NULL)
|
||||
);
|
||||
r->response.header.www_authenticate.scheme = BASIC;
|
||||
r->response.header.www_authenticate.realm = "Serval RESTful API";
|
||||
return 401;
|
||||
|
Loading…
Reference in New Issue
Block a user