mikroSDK Reference Manual
http_client_auth.h
Go to the documentation of this file.
1
31#ifndef _HTTP_CLIENT_AUTH_H
32#define _HTTP_CLIENT_AUTH_H
33
34//Dependencies
35#include "core/net.h"
36#include "http/http_client.h"
37
38//Maximum digest size
39#if (HTTP_CLIENT_SHA512_256_SUPPORT == ENABLED)
40 #define HTTP_CLIENT_MAX_HASH_DIGEST_SIZE 32
41#elif (HTTP_CLIENT_SHA256_SUPPORT == ENABLED)
42 #define HTTP_CLIENT_MAX_HASH_DIGEST_SIZE 32
43#else
44 #define HTTP_CLIENT_MAX_HASH_DIGEST_SIZE 16
45#endif
46
47//Maximum response length
48#if (HTTP_CLIENT_SHA512_256_SUPPORT == ENABLED)
49 #define HTTP_CLIENT_MAX_RESPONSE_LEN 64
50#elif (HTTP_CLIENT_SHA256_SUPPORT == ENABLED)
51 #define HTTP_CLIENT_MAX_RESPONSE_LEN 64
52#else
53 #define HTTP_CLIENT_MAX_RESPONSE_LEN 32
54#endif
55
56//C++ guard
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61
66typedef struct
67{
69 const char_t *realm;
70 size_t realmLen;
71#if (HTTP_CLIENT_DIGEST_AUTH_SUPPORT == ENABLED)
73 const HashAlgo *algorithm;
74 const char_t *nonce;
75 size_t nonceLen;
76 const char_t *opaque;
77 size_t opaqueLen;
78 bool_t stale;
79#endif
81
82
83//HTTP client related functions
84void httpClientInitAuthParams(HttpClientAuthParams *authParams);
85
86error_t httpClientFormatAuthorizationField(HttpClientContext *context);
87
88error_t httpClientParseWwwAuthenticateField(HttpClientContext *context,
89 const char_t *value);
90
91void httpClientParseQopParam(const HttpParam *param,
92 HttpWwwAuthenticateHeader *authHeader);
93
94void httpClientParseAlgorithmParam(const HttpParam *param,
95 HttpWwwAuthenticateHeader *authHeader);
96
97error_t httpClientComputeDigest(HttpClientAuthParams *authParams,
98 const char_t *method, size_t methodLen, const char_t *uri,
99 size_t uriLen, char_t *response);
100
101//C++ guard
102#ifdef __cplusplus
103}
104#endif
105
106#endif
error_t
Error codes.
Definition error.h:43
HTTP client (HyperText Transfer Protocol)
HttpAuthMode
HTTP authentication schemes.
Definition http_common.h:72
HttpAuthQop
Quality of protection (digest authentication)
Definition http_common.h:84
TCP/IP stack core.
HTTP authentication parameters.
Definition http_client.h:244
Attribute-value pair.
Definition http_common.h:157
WWW-Authenticate header field.
Definition http_client_auth.h:67
size_t nonceLen
Length of the nonce value.
Definition http_client_auth.h:75
size_t opaqueLen
Length of the opaque parameter.
Definition http_client_auth.h:77
const char_t * nonce
Nonce value.
Definition http_client_auth.h:74
size_t realmLen
Length of the realm.
Definition http_client_auth.h:70
HttpAuthMode mode
Authentication scheme.
Definition http_client_auth.h:68
const char_t * realm
Realm.
Definition http_client_auth.h:69
HttpAuthQop qop
Quality of protection.
Definition http_client_auth.h:72
bool_t stale
Stale flag.
Definition http_client_auth.h:78
const HashAlgo * algorithm
Digest algorithm.
Definition http_client_auth.h:73
const char_t * opaque
Opaque parameter.
Definition http_client_auth.h:76