summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown2017-11-11 23:05:53 +0100
committerMichael Brown2017-11-12 19:52:04 +0100
commit96bd872c0342fcc290e9162154d07371405cf384 (patch)
treedcae7f76bfc6a5d86f839d545c85849367fd7b5d /src/include/ipxe
parent[http] Gracefully handle offers of multiple authentication schemes (diff)
downloadipxe-96bd872c0342fcc290e9162154d07371405cf384.tar.gz
ipxe-96bd872c0342fcc290e9162154d07371405cf384.tar.xz
ipxe-96bd872c0342fcc290e9162154d07371405cf384.zip
[http] Handle parsing of WWW-Authenticate header within authentication scheme
Allow individual authentication schemes to parse WWW-Authenticate headers that do not comply with RFC2617. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/http.h55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/include/ipxe/http.h b/src/include/ipxe/http.h
index a0dff7d0..0f42a22e 100644
--- a/src/include/ipxe/http.h
+++ b/src/include/ipxe/http.h
@@ -150,14 +150,18 @@ struct http_request_content {
size_t len;
};
-/** HTTP request authentication descriptor */
-struct http_request_auth {
- /** Authentication scheme (if any) */
- struct http_authentication *auth;
+/** HTTP request Basic authentication descriptor */
+struct http_request_auth_basic {
/** Username */
const char *username;
/** Password */
const char *password;
+};
+
+/** HTTP request Digest authentication descriptor */
+struct http_request_auth_digest {
+ /** Username */
+ const char *username;
/** Quality of protection */
const char *qop;
/** Algorithm */
@@ -168,6 +172,19 @@ struct http_request_auth {
char response[ HTTP_DIGEST_RESPONSE_LEN + 1 /* NUL */ ];
};
+/** HTTP request authentication descriptor */
+struct http_request_auth {
+ /** Authentication scheme (if any) */
+ struct http_authentication *auth;
+ /** Per-scheme information */
+ union {
+ /** Basic authentication descriptor */
+ struct http_request_auth_basic basic;
+ /** Digest authentication descriptor */
+ struct http_request_auth_digest digest;
+ };
+};
+
/** An HTTP request
*
* This represents a single request to be sent to a server, including
@@ -235,10 +252,12 @@ struct http_response_content {
struct http_content_encoding *encoding;
};
-/** HTTP response authorization descriptor */
-struct http_response_auth {
- /** Authentication scheme (if any) */
- struct http_authentication *auth;
+/** HTTP response Basic authorization descriptor */
+struct http_response_auth_basic {
+};
+
+/** HTTP response Digest authorization descriptor */
+struct http_response_auth_digest {
/** Realm */
const char *realm;
/** Quality of protection */
@@ -251,6 +270,19 @@ struct http_response_auth {
const char *opaque;
};
+/** HTTP response authorization descriptor */
+struct http_response_auth {
+ /** Authentication scheme (if any) */
+ struct http_authentication *auth;
+ /** Per-scheme information */
+ union {
+ /** Basic authorization descriptor */
+ struct http_response_auth_basic basic;
+ /** Digest authorization descriptor */
+ struct http_response_auth_digest digest;
+ };
+};
+
/** An HTTP response
*
* This represents a single response received from the server,
@@ -461,6 +493,13 @@ struct http_content_encoding {
struct http_authentication {
/** Name (e.g. "Digest") */
const char *name;
+ /** Parse remaining "WWW-Authenticate" header line
+ *
+ * @v http HTTP transaction
+ * @v line Remaining header line
+ * @ret rc Return status code
+ */
+ int ( * parse ) ( struct http_transaction *http, char *line );
/** Perform authentication
*
* @v http HTTP transaction