http_server_auth.h File Reference

HTTP authentication. More...

#include "http/http_server.h"

Go to the source code of this file.

Functions

bool_t httpCheckPassword (HttpConnection *connection, const char_t *password, HttpAuthMode mode)
 Password verification. More...
 
void httpParseAuthorizationField (HttpConnection *connection, char_t *value)
 Parse Authorization header field. More...
 
size_t httpAddAuthenticateField (HttpConnection *connection, char_t *output)
 Format WWW-Authenticate header field. More...
 
error_t httpGenerateNonce (HttpServerContext *context, char_t *output, size_t *length)
 Nonce generation. More...
 
error_t httpVerifyNonce (HttpServerContext *context, const char_t *nonce, const char_t *nc)
 Nonce verification. More...
 

Detailed Description

HTTP authentication.

License

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

Copyright (C) 2010-2024 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
2.4.0

Definition in file http_server_auth.h.

Function Documentation

◆ httpAddAuthenticateField()

size_t httpAddAuthenticateField ( HttpConnection connection,
char_t output 
)

Format WWW-Authenticate header field.

Parameters
[in]connectionStructure representing an HTTP connection
[out]outputBuffer where to format the header field
Returns
Total length of the header field

Definition at line 400 of file http_server_auth.c.

◆ httpCheckPassword()

bool_t httpCheckPassword ( HttpConnection connection,
const char_t password,
HttpAuthMode  mode 
)

Password verification.

Parameters
[in]connectionStructure representing an HTTP connection
[in]passwordNULL-terminated string containing the password to be checked
[in]modeHTTP authentication scheme to be used. Acceptable values are HTTP_AUTH_MODE_BASIC or HTTP_AUTH_MODE_DIGEST
Returns
TRUE if the password is valid, else FALSE

Definition at line 56 of file http_server_auth.c.

◆ httpGenerateNonce()

error_t httpGenerateNonce ( HttpServerContext context,
char_t output,
size_t *  length 
)

Nonce generation.

Parameters
[in]contextPointer to the HTTP server context
[in]outputNULL-terminated string containing the nonce
[in]lengthNULL-terminated string containing the nonce count
Returns
Error code

Definition at line 495 of file http_server_auth.c.

◆ httpParseAuthorizationField()

void httpParseAuthorizationField ( HttpConnection connection,
char_t value 
)

Parse Authorization header field.

Parameters
[in]connectionStructure representing an HTTP connection
[in]valueAuthorization field value

Definition at line 198 of file http_server_auth.c.

◆ httpVerifyNonce()

error_t httpVerifyNonce ( HttpServerContext context,
const char_t nonce,
const char_t nc 
)

Nonce verification.

Parameters
[in]contextPointer to the HTTP server context
[in]nonceNULL-terminated string containing the nonce
[in]ncNULL-terminated string containing the nonce count
Returns
Error code

Definition at line 587 of file http_server_auth.c.