http_client_auth.h File Reference

HTTP authentication. More...

#include "core/net.h"
#include "http/http_client.h"

Go to the source code of this file.

Data Structures

struct  HttpWwwAuthenticateHeader
 WWW-Authenticate header field. More...
 

Macros

#define HTTP_CLIENT_MAX_HASH_CONTEXT_SIZE   sizeof(Sha512_256Context)
 
#define HTTP_CLIENT_MAX_HASH_DIGEST_SIZE   32
 
#define HTTP_CLIENT_MAX_RESPONSE_LEN   64
 

Functions

void httpClientInitAuthParams (HttpClientAuthParams *authParams)
 Initialize HTTP authentication parameters. More...
 
error_t httpClientFormatAuthorizationField (HttpClientContext *context)
 Format Authorization header field. More...
 
error_t httpClientParseWwwAuthenticateField (HttpClientContext *context, const char_t *value)
 Parse WWW-Authenticate header field. More...
 
void httpClientParseQopParam (const HttpParam *param, HttpWwwAuthenticateHeader *authHeader)
 Parse qop parameter. More...
 
void httpClientParseAlgorithmParam (const HttpParam *param, HttpWwwAuthenticateHeader *authHeader)
 Parse algorithm parameter. More...
 
error_t httpClientComputeDigest (HttpClientAuthParams *authParams, const char_t *method, size_t methodLen, const char_t *uri, size_t uriLen, char_t *response)
 Digest operation. More...
 

Detailed Description

HTTP authentication.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.4

Definition in file http_client_auth.h.

Macro Definition Documentation

◆ HTTP_CLIENT_MAX_HASH_CONTEXT_SIZE

#define HTTP_CLIENT_MAX_HASH_CONTEXT_SIZE   sizeof(Sha512_256Context)

Definition at line 40 of file http_client_auth.h.

◆ HTTP_CLIENT_MAX_HASH_DIGEST_SIZE

#define HTTP_CLIENT_MAX_HASH_DIGEST_SIZE   32

Definition at line 49 of file http_client_auth.h.

◆ HTTP_CLIENT_MAX_RESPONSE_LEN

#define HTTP_CLIENT_MAX_RESPONSE_LEN   64

Definition at line 58 of file http_client_auth.h.

Function Documentation

◆ httpClientComputeDigest()

error_t httpClientComputeDigest ( HttpClientAuthParams authParams,
const char_t method,
size_t  methodLen,
const char_t uri,
size_t  uriLen,
char_t response 
)

Digest operation.

Parameters
[in]authParamsHTTP authentication parameters
[in]methodPointer to the HTTP method
[in]methodLenLength of the HTTP method
[in]uriPointer to the URI
[in]uriLenLength of the URI
[out]responsePointer to the resulting digest
Returns
Error code

Definition at line 587 of file http_client_auth.c.

◆ httpClientFormatAuthorizationField()

error_t httpClientFormatAuthorizationField ( HttpClientContext context)

Format Authorization header field.

Parameters
[in]contextPointer to the HTTP client context
Returns
Error code

Definition at line 92 of file http_client_auth.c.

◆ httpClientInitAuthParams()

void httpClientInitAuthParams ( HttpClientAuthParams authParams)

Initialize HTTP authentication parameters.

Parameters
[in]authParamsHTTP authentication parameters

Definition at line 64 of file http_client_auth.c.

◆ httpClientParseAlgorithmParam()

void httpClientParseAlgorithmParam ( const HttpParam param,
HttpWwwAuthenticateHeader authHeader 
)

Parse algorithm parameter.

Parameters
[in]paramPointer to the algorithm parameter
[in,out]authHeaderPointer to the WWW-Authenticate header field

Definition at line 535 of file http_client_auth.c.

◆ httpClientParseQopParam()

void httpClientParseQopParam ( const HttpParam param,
HttpWwwAuthenticateHeader authHeader 
)

Parse qop parameter.

Parameters
[in]paramPointer to the algorithm parameter
[in,out]authHeaderPointer to the WWW-Authenticate header field

Definition at line 489 of file http_client_auth.c.

◆ httpClientParseWwwAuthenticateField()

error_t httpClientParseWwwAuthenticateField ( HttpClientContext context,
const char_t value 
)

Parse WWW-Authenticate header field.

Parameters
[in]contextPointer to the HTTP client context
[in]valueNULL-terminated string that contains the value of header field
Returns
Error code

Definition at line 288 of file http_client_auth.c.