http_server_auth.c File Reference

HTTP authentication. More...

#include <stdlib.h>
#include "core/net.h"
#include "http/http_server.h"
#include "http/http_server_auth.h"
#include "http/http_server_misc.h"
#include "str.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   HTTP_TRACE_LEVEL
 

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

Copyright (C) 2010-2018 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.0

Definition in file http_server_auth.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   HTTP_TRACE_LEVEL

Definition at line 30 of file http_server_auth.c.

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 398 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 54 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 487 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 196 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 575 of file http_server_auth.c.