1 /* 2 * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 8 #ifndef _HTTP_BASIC_AUTH_H_ 9 #define _HTTP_BASIC_AUTH_H_ 10 11 /** 12 * HTTP Digest authentication data 13 */ 14 typedef struct { 15 char *method; /*!< Request method, example: GET */ 16 char *algorithm; /*!< Authentication algorithm */ 17 char *uri; /*!< URI of request example: /path/to/file.html */ 18 char *realm; /*!< Authentication realm */ 19 char *nonce; /*!< Authentication nonce */ 20 char *qop; /*!< Authentication qop */ 21 char *opaque; /*!< Authentication opaque */ 22 uint64_t cnonce; /*!< Authentication cnonce */ 23 int nc; /*!< Authentication nc */ 24 } esp_http_auth_data_t; 25 26 /** 27 * @brief This use for Http digest authentication method, create http header for digest authentication. 28 * The returned string need to free after use 29 * 30 * @param[in] username The username 31 * @param[in] password The password 32 * @param auth_data The auth data 33 * 34 * @return 35 * - HTTP Header value of Authorization, valid for digest authentication, must be freed after usage 36 * - NULL 37 */ 38 char *http_auth_digest(const char *username, const char *password, esp_http_auth_data_t *auth_data); 39 40 /** 41 * @brief This use for Http basic authentication method, create header value for basic http authentication 42 * The returned string need to free after use 43 * 44 * @param[in] username The username 45 * @param[in] password The password 46 * 47 * @return 48 * - HTTP Header value of Authorization, valid for basic authentication, must be free after use 49 * - NULL 50 */ 51 char *http_auth_basic(const char *username, const char *password); 52 #endif 53