diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib-http/http-auth.h | |
parent | Initial commit. (diff) | |
download | dovecot-upstream.tar.xz dovecot-upstream.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib-http/http-auth.h')
-rw-r--r-- | src/lib-http/http-auth.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/lib-http/http-auth.h b/src/lib-http/http-auth.h new file mode 100644 index 0000000..061f9ce --- /dev/null +++ b/src/lib-http/http-auth.h @@ -0,0 +1,79 @@ +#ifndef HTTP_AUTH_H +#define HTTP_AUTH_H + +#include "array-decl.h" + +struct http_auth_param; +struct http_auth_challenge; +struct http_auth_credentials; + +ARRAY_DEFINE_TYPE(http_auth_param, struct http_auth_param); +ARRAY_DEFINE_TYPE(http_auth_challenge, struct http_auth_challenge); + +struct http_auth_param { + const char *name; + const char *value; +}; + +struct http_auth_challenge { + const char *scheme; + const char *data; + ARRAY_TYPE(http_auth_param) params; +}; + +struct http_auth_credentials { + const char *scheme; + const char *data; + ARRAY_TYPE(http_auth_param) params; +}; + +/* + * Parsing + */ + +int http_auth_parse_challenges(const unsigned char *data, size_t size, + ARRAY_TYPE(http_auth_challenge) *chlngs); +int http_auth_parse_credentials(const unsigned char *data, size_t size, + struct http_auth_credentials *crdts); + +/* + * Construction + */ + +void http_auth_create_challenge(string_t *out, + const struct http_auth_challenge *chlng); +void http_auth_create_challenges(string_t *out, + const ARRAY_TYPE(http_auth_challenge) *chlngs); + +void http_auth_create_credentials(string_t *out, + const struct http_auth_credentials *crdts); + +/* + * Manipulation + */ + +void http_auth_challenge_copy(pool_t pool, + struct http_auth_challenge *dst, + const struct http_auth_challenge *src); +struct http_auth_challenge * +http_auth_challenge_clone(pool_t pool, + const struct http_auth_challenge *src); + +void http_auth_credentials_copy(pool_t pool, + struct http_auth_credentials *dst, + const struct http_auth_credentials *src); +struct http_auth_credentials * +http_auth_credentials_clone(pool_t pool, + const struct http_auth_credentials *src); + +/* + * Simple schemes + */ + +void http_auth_basic_challenge_init(struct http_auth_challenge *chlng, + const char *realm); +void http_auth_basic_credentials_init(struct http_auth_credentials *crdts, + const char *username, const char *password); + +#endif + |